3.13. 注册一个LoadTimeWeaver

Spring 2.5引入的context名字空间提供了一个load-time-weaver元素。

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

在一个基于XML的Spring配置文件中加入这个元素能为ApplicationContext 激活一个Spring LoadTimeWeaver。 那个ApplicationContext中的任何bean都可以实现 LoadTimeWeaverAware,从而收到一个加载时织入器(load-time weaver)的实例。 这在与Spring JPA支持结合时特别有用,JPA类转换需要加载时织入。 请查看LocalContainerEntityManagerFactoryBean的Javadoc以获得详细信息。 想要更多地了解AspectJ加载时织入的话,请参考第 6.8.4 节 “在Spring应用中使用AspectJ加载时织入(LTW)”