In my dispatcher-servlet.xml file I have several controller beans defined as below:
In my applicationContext.xml I define bean1 which includes an init-method attribute. There are also various child property elements not listed.
I define no other beans that correspond to the example.Bean1 class and no classes in my app call the example.Bean1.init method.
In my web app the example.Bean1.init method get called multiple times, once per each controller bean that references bean1. Is this the expected behavior? I have come accross a number of articles and postings that discuss bean lifecycles, but none addressed this particular point.
What I was hoping is that the example.Bean1.init method would be called exactly once no matter how many other beans reference it, but that appears to not be the case. Is there a way to get the behavior I am looking for?
I am using Spring Web MVC 2.5 and use Netbeans 6.1 to deploy my web app to Apache
Tomcat 6 in case that matters.
TH