We work with a web application and autowire beans using WebApplicationContextUtils in the init method.
Could you clarify some details about bean initialization?
The question rises from the static factory method.
Suppose there's a bean that is created in a static factory method.
As we can see, when the web app is deployed, the ContextLoaderListener initializes all the beans present
in Spring xml config file.
Now happens such a thing. In the static factory method we run a timer that starts ticking.
But in reality we wouldn't want it to start ticking unless the bean is injected into a property of the object !
That is question number one - all the beans are automatically initialized on deploy - correct?
And after that when we need an injection, it simply feels the link with the address of the object created during initialization, though OBJECT WAS CREATED ON WEB APP DEPLOY, immediately ! (I assume the default singleton-creation Spring behavior)
Second question: are all copies of a web app use the same beans, so all beans are WEB-APP wide, every Spring bean is shared between all the copies of this web app running?