【发布时间】:2016-02-22 17:50:21
【问题描述】:
从 tomcat 7 java 7 迁移到 tomcat 8 java 8 时出现问题。
在 Tomcat 7 中,加载时间编织基于 context.xml 文件中指定的加载器类工作
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
作为迁移的一部分,我们从 context.xml 中删除了上述加载器类定义,并将应用程序部署到 tomcat8。
现在加载时间编织仅适用于调度程序 servlet 加载的 bean 并且 ContextLoaderListener 加载的 applicationContext.xml 中的 bean 不起作用?请提供任何建议。
再次重复同一个问题..
如何防止applicationContext.xml中的bean 在开始加载时间编织之前加载?
我正在尝试在没有 -javaagent 选项的情况下配置加载时间编织器可以吗?
请注意下面给出的配置的重要部分
applicationContext.xml
<aop:aspectj-autoproxy />
<context:spring-configured />
<context:load-time-weaver aspectj-weaving="autodetect"/>
<tx:annotation-driven transaction-manager="transactionManager" mode="aspectj"/>
<bean id="mainContextLoadingService"
class="com.riyaskt.trial.service.impl.MainContextLoadingServiceImpl" />
dispatcher-servlet.xml
<context:component-scan base-package="com.riyaskt.trial" />
<mvc:annotation-driven/>
<bean id="sampleService"
class="com.riyaskt.trial.service.impl.SampleServiceImpl"
p:dao-ref="sampleDao"/>
在这两个服务 bean 中(即 applicationContext.xml 中的 mainContextLoadingService 和 dispatcher servlet 中的 sampleService)。
sampleService 编织得当
但是
mainContextLoadingService 没有被加载时间编织器编织..
【问题讨论】:
-
打开 org.springframework 的调试日志并检查是否在删除 tomcat 加载程序时遇到任何错误。如果是,请编辑您的主要帖子并将其添加到那里。
标签: java spring spring-mvc tomcat