get paid to paste

*Aware* interfaces in Spring

Quite often we are in need of an ApplicationContext in our class. Likewise there are other objects too.. We don't have to break our heads on how to access those objects.. There's a very good chance that Spring has an *Aware* inteface for the object we are looking for. (A list of such interfaces: http://tinypaste.com/278d69)

Now the class which needs access just has to implement this interface. In most cases that would involve creating a setter method.

And that's it. Spring IoC container, while starting up, injects the object that we need :)

Pasted: Jun 17, 2011, 3:09:39 am
Views: 74