此问题发生在从tomcat 7 java 7迁移到tomcat 8 java 8时。
在Tomcat 7中,加载时间编织是基于context.xml文件中指定的装入器类工作的。
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/> 作为迁移的一部分,我们从context.xml中删除了上述加载器类定义,并将应用程序部署到tomcat8。
现在,加载时间编织只适用于dispatcher servlet加载的bean,而由加载的applicationContext.xml中的ContextLoaderListener 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中(即mainContextLoadingService In applicationContext.xml和sampleService from dispatcher servlet)。
sampleService被正确地编织
但
mainContextLoadingService 不是按加载时间编织的。
发布于 2015-11-20 11:24:04
试试弹簧乐器罐。从这个链接下载最新的4.2.3JAR。eclipse中tomcat的打开启动配置(双击Servers中的tomcat,选项卡&单击)。现在,单击参数选项卡,并将下面一行附加到VM参数中。
-javaagent:<Path to Spring Instrument jar you downloaded>例如,您下载了spring 4.2.3.RELEASE.jar并放置在D驱动器中,那么javaagent参数如下:
-javaagent:D:\spring-instrument-4.2.3.RELEASE.jar发布于 2016-02-03 08:11:58
使用AspectJ - With =“autodetect”属性,如果类路径上存在“META/aop.xml”资源,则默认情况下将激活AspectJ织入。
https://stackoverflow.com/questions/33823336
复制相似问题