Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Yes, of course, @Autowire is not the single cause, it just makes it easier to ignore layer constraints. If you would have Spring configuration classes for the different layers instead (ServiceConfig, DataAccessConfig), then it would be more obvious if someone wires something which should not be wired. Nevertheless, what is the point for doing such a refactoring/layering? Testability? (Can still be fine with mocking) Maintainability? Readability? Maybe I am wrong and everything is fine with the app. Are my headaches justified in your opinion? Commented Mar 20, 2018 at 13:56
  • @rainer198 I don't know. The whole thing is very specific to your app. I can just say that your architecture issue is totally unrelated to @Autowired, or Spring for that matter. It's probably just the basics of loose coupling / high cohesion that are neglected. I don't know exactly what you're looking for. There is no silver bullet for that. Commented Mar 20, 2018 at 14:39