title: Insert bean from applicationContext into POJO
body: <p>I have all of my DAO's as beans in my applicationContext. Now this works great for autowiring these objects into my controllers to make database calls. However, given that I have embedded objects within some of my POJO's (Example: User class has list of pendingsurvey objects, list of appointment objects, etc) and don't want to grab these embedded objects when I grab the main object (Example: In a page with a list of users I don't need to know their pendingsurveys or appointments), I had set it up so that if the embedded object is null, go to the database to get the data. However, apparently @Autowire doesn't work in this case because the POJO's are not a Spring controlled object or something.</p>
  
  <p>So question now is, how can I get a bean from applicationContext to use in my POJO's? I'm not that good with Spring so specific instructions would be greatly appreciated..</p>
  
  <p>I've tried this but it gives me a bunch of injection dependency errors:</p>
  
  <pre><code>/* applicationContext.xml */
  &lt;bean id="userDao" class="UserDao" scope="singleton"&gt;
      &lt;property name="connectionWrapper" ref="connectionWrapper" /&gt;
  &lt;/bean&gt;
  
  /* User.java - I tried putting in constructor and in the getter for userDao */
  ApplicationContext ctx = AppContext.getApplicationContext('applicationContext.xml');
  UserDao userDao = (UserDao) ctx.getBean("userDao");
  </code></pre>