I realize this should be really basic but I haven't found a second step example after Helloworld
So what I have is:
spring config xml called spring-beans.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
    <context:annotation-config />
    <context:component-scan base-package="org" />
</beans>
A spring context initialized class:
public static void main(String[] args) {
    // initialize Spring
    ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring-beans.xml");
    App app = (App) context.getBean("app");
    app.run();
}
Relevant details of AppImpl class:
@Component("app")
public final class AppImpl implements App{    
    // focus of question: This autowiring works
    @Autowired
    private DAO1 dao1;
    public void run() {
        //focus of question: This works as daoclass is instantiated properly                   
        obj1s = dao1.myFind();            
        badJobs = runJobs(obj1s);
    }
    private List<Obj1> runJobs(final List<Obj1> obj1s) {        
        List<Obj1> jobsGoneBad = new ArrayList<Obj1>();
        for (Obj1 next : obj1s) {
            // focus of question: usage of new keyword, thus not spring container managed?
            Job job = new JobImpl(next);
            job.run();
        }
        return jobsGoneBad;
    }    
}
Relevant details of JobImpl:
public class JobImpl implements Job {
    private Obj1 obj1;
    // focus of question: can't autowire
    @Autowired
    private DAO2 dao2;
    @Override
    public void run() {
        //focus of question: opDAO == null - not initialized by @Autowired
        Obj2 obj2 = dao2.myFind();        
    }
}
Relevant details of DAO1:
@Repository("DAO1") //Focus of question: DAO1 is a repository stereotype
public class DAO1 {
    myfind() { ...}
}
Relevant details of DAO2:
@Repository("DAO2") //Focus of question: DAO2 is a repository stereotype
public class DAO2 {        
    myfind() { ...}
}
Right, so I initialize the App through a springcontext call and then succesfully instantiate a DAO1 instance through the use of @Autowired.
Then I create an unmanaged instance of Job and want to inject "singeltonish" dependencies in that class too by using @Autowired
Both Dao classes are spring stereotypes and scanner finds them fine.
So my question is basically, how should I instantiate the job instance so that I can use @Autowired concept inside it?
If I need a globally accessible applicationcontext, how do I best introduce that?
 
     
     
     
     
    