We are using a similar approach to the batch admin project where each job is configured in its own spring configuration file. We use the AutomaticJobRegistar class to scan those files and load them.
In our main applicationContext we have the following:
While our code is running fine in a unit test, it fails in Tomcat with our EntityContext being null (@PersistenceContext). If we add the following to the job configuration file it worksCode:context:annotation-config/>
Why is that? Isn't context:annotation-config supposed to be reachable and applied in the child contexts as well? Having to define this for each and every job is really painful.Code:bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
BTW, I can reproduce the problem in a unit test as soon as I use the AutomaticJobRegistar (e.g. child contexts) to load my job.


Reply With Quote
