Interesting post about DI, Spring and JEE

Java and the need for Dependency Injection

Somehow, I agree with the writer that Spring can be very intrusive and is much too big. As soon as you start using it, you are bound to it and with all components its already about 20MB.  The positive argument is that it helps a lot in writing clean separated, testable code. For me the main reason to use Spring is to have an IoC container that manages bigger components. But often people go too far in using Spring by putting everything into the container either through configuration or annotation. This as I can see leads again to unmanageable code which is the opposite of the intention of DI.

With JEE 5 Sun has made a great step in simplifying the technology stack. Using annotations to declare specific cross-cutting concerns (transactions) and resource injections helps a lot. Still developer should know at least for resouce injection how it is mapped to the JNDI tree. So they understand how this can also be solved by other solutions (ServiceLocator).

I would like to see the Spring container moving towards the JEE specification by supporting all JEE annotations as well as their own especially with respect to transactions. So people can write code once and run it in different containers (JEE, Spring, etc.).


Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )


Verbinde mit %s