Hacker News new | ask | show | jobs
by coutego 1306 days ago
Spring does not need to infect your codebase. You can use the container without importing anything from Spring in other than one class (the one bootstrapping the system).

If you want to use Spring classes in the implementation of your clases then yes, you will need to import them. But this is no different than any other library.

If you just use XML configuration files (or use @Configuration) you don't (shouldn't) use @Inject, @Autowire and all other abominations. Or at least you didn't need, last time I checked a couple years ago. All your code is clear, free of any Spring code (unless you use some of the libraries) and fully reusable, testable, etc.

Why everyone moved to annotations for "dependency injection" (that crap is NOT DI!!!!!), not only in Java, but Python, Typescript, etc. I just can't understand. It can't only be the convenience of doing so by saving some keystrokes, but I just can't get it. We solved the modularity beautifully with Spring (and other DI engines) and then we proceed to throw away the solution and recreate the problem again? Get off my lawn...