Spring框架Tomcat LoadTimeWeaving

时间:2012-07-02 23:50:30

标签: tomcat jpa lazy-loading eclipselink load-time-weaving

我使用tomcat作为我的网络服务器,并希望对我所有的@OneToOne注释使用fetch = FetchType.lazy注释,但是春天还原我的懒惰设置给我eclipselink警告:

Reverting the lazy setting on the OneToOne or ManyToOne attribute [student] for the entity class [class org.bixin.dugsi.domain.Registration] since weaving was not enabled or did not occur.

我需要做什么才能让tomcat进行编织工作,以便我可以使用延迟抓取,或者是否有其他替代延迟加载关系的方法。我有巨大的性能问题?

我现在正在尝试添加加载时编织,我已将spring-instruments.jar和spring-aspects.jar添加到我的tomcat / lib中,并在将全局<context:load-time-weaver/>添加到我的applicationContext.xml文件后,得到一个

ClassLoader [sun.misc.Launcher$AppClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar

1 个答案:

答案 0 :(得分:1)

我建议使用静态编织,参见,

http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving

可以在春天进行编织工作。我建议从Tomcat之外的一个Spring教程开始,慢慢增加复杂性,直到你在Tomcat中工作。