title: Spring bean initialization in a web app
body: <p>We work with a web application and autowire beans using WebApplicationContextUtils in the init method.</p>
  
  <p>Could you clarify some details about bean initialization?</p>
  
  <p>The question rises from the static factory method.</p>
  
  <p>Suppose there's a bean that is created in a static factory method. </p>
  
  <p>As we can see, when the web app is deployed, the ContextLoaderListener initializes all the beans present</p>
  
  <p>in Spring xml config file.</p>
  
  <p>Now happens such a thing. In the static factory method we run a timer that starts ticking.</p>
  
  <p>But in reality we wouldn't want it to start ticking unless the bean is injected into a property of the object !</p>
  
  <p>That is question number one -<b> all the beans are automatically initialized on deploy - correct? </b></p>
  
  <p>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)</p>
  
  <p>Second question: <b>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?</b></p>