3.12 Registering a LoadTimeWeaver

The context namespace introduced in Spring 2.5 provides a load-time-weaver element.

<beans>
     
     <context:load-time-weaver/>
     
</beans>

Adding this element to an XML-based Spring configuration file activates a Spring LoadTimeWeaver for the ApplicationContext. Any bean within that ApplicationContext may implement LoadTimeWeaverAware, thereby receiving a reference to the load-time weaver instance. This is particularly useful in combination with Spring's JPA support where load-time weaving may be necessary for JPA class transformation. Consult the LocalContainerEntityManagerFactoryBean Javadoc for more detail. For more on AspectJ load-time weaving, see Section 7.8.4, “Load-time weaving with AspectJ in the Spring Framework”.