Environment: JDK 1.6, Maven 2.2.1, Hibernate 3.6.7.Final via Hibernate EntityManager, Spring 3.1.0.RELEASE.
I can't figure out why my the entity listener instances aren't getting injected by type with @Autowired
dependencies, even though I've made sure to include <context:spring-configured/>
in my application context and included a depends-on="org.springframework.context.config.internalBeanConfigurerAspect
in my LocalContainerEntityManagerFactoryBean bean definition.
The appropriate @Entity
classes include @EntityListeners({...})
, and the entity listener classes are annotated with @Configurable
, and their dependencies are annotated with @Autowired
.
In the log, I see the internalBeanConfigurerAspect
being instantiated, I can see my listeners getting instantiated by Hibernate via reflection, but I never see the injection taking place, and then I get a NPE in the listener when the listener's injected dependencies get invoked. I've tried every magical incantation & can't seem to find the right one.
Anyone have any ideas what I have to jiggle to trigger the @Configurable
DI?
TIA, Matthew
@Configurable support requires weaving using Aspectj - either compile time weaving or load time weaving should work. Can you confirm if your using aspectj weaving, if not that could be the reason why the @Configurable annotated beans are not being autowired in.