I’ve applicationContext.xml which contains below line:
<bean id="myclass" class="com.abc.myclassinfo" >
</bean>
And, myclassinfo.java has below code:
public class myclassinfo {
public myclassinfo() {
// Here I'm initializing Jersey client
}
}
Now, what happens when spring loads the applicationContext.xml? Does it invoke this constructor?
Also, if I want to insitialize the Jersey client some other way without applicationContext.xml, how do I do that?
Thanks!
@PostConstruct/init-methodIF you want to use the class outside spring, you just instantiate it (using the constructor), and manually invoke the init method (if such exists). Note that you lose the automatic proxies that spring creates around your objects for transactions, scheduling, caching, etc.