【问题标题】:Spring framework Tomcat LoadTimeWeavingSpring框架Tomcat LoadTimeWeaving
【发布时间】:2012-07-03 09:39:01
【问题描述】:

我正在使用 tomcat 作为我的网络服务器,并且想对我所有的 @OneToOne 注释使用 fetch = FetchType.lazy 注释,但是 spring 恢复了我的惰性设置给我 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

【问题讨论】:

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


【解决方案1】:

我建议改用静态编织,请参阅,

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

可以在春季开始编织工作。我建议从 Tomcat 之外的 Spring 教程之一开始,然后慢慢增加复杂性,直到它在 Tomcat 中运行。

【讨论】:

  • 我查看了此文档,并且很难正确遵循(配置)。我怎么知道我已经正确启用了静态编织,是否有一个 github 存储库示例项目有一个使用 tomcat 作为 Web 服务器的示例?
  • 如果我使用静态编织,我是否必须在构建和运行项目时始终运行命令行参数
  • 是的,您必须在 jar 上运行任务并使用它输出的编织 jar。
  • 不能把它放在我的项目中一次以利用 eclipse 作为我的运行、构建和部署工具。我尝试添加 maven-ant 插件并添加指定的任务,但似乎没有任何效果,并且延迟设置被恢复
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-07-22
  • 2023-04-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-01
相关资源
最近更新 更多