Spring Boot, @Autowire into an unmanaged class using @Configurable and load time weaving

前端 未结 1 483
暗喜
暗喜 2021-01-02 18:40

I have a collection of unmanaged classes that I are instantiated outside of Spring. I\'ve been attempting to use Spring AOP with load time weaving to @Autowire

相关标签:
1条回答
  • 2021-01-02 19:09

    In order to instrument LTW you'll need to either use the javaagent or place spring-tomcat-weaver.jar in the \lib folder and set up TomcatInstrumentableClassLoader in context.xml.

    javaagent example:

    -javaagent:"${settings.localRepository}/org/springframework/spring-agent/2.5.6.SEC03/spring-agent-2.5.6.SEC03".jar
    

    ClassLoader example:

    <Context>
        <Loader loaderClass="org.springframework.instrument.classl oading.tomcat.TomcatInstrumentableClassLoader" />
    </Context>
    
    0 讨论(0)
提交回复
热议问题