I have a set of unmanaged classes that I created outside of Spring. I am trying to use Spring AOP with loading time in @Autowire a bean in these classes, but still no luck.
I tested with Tomcat 8 and Spring Boot 1.2.0.
My @Configuration , where I am trying to configure a class, is as follows:
@Configuration @PropertySource("classpath:application.properties") @EnableSpringConfigured @EnableLoadTimeWeaving public class Config
Inside Config I define a bean I want @Auotwire in my unmanaged classes:
@Bean public StateProvider stateProvider() {
An unmanaged bean is as follows:
@Configurable(autowire = Autowire.BY_TYPE, dependencyCheck = true, preConstruction = true) public class StateOutput implements UnifiedOutput { @Autowired private StateProvider stateProvider;
And I have the following fingerprints inside my pom
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-agent</artifactId> <version>2.5.6.SEC03</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </dependency> <dependency> <groupId>javax.el</groupId> <artifactId>javax.el-api</artifactId> <version>3.0.0</version> </dependency>
Until now, I could not see anything entered in stateProvider or was able to pull any information from the logs. I also tried to introduce a setter style using
@Autowired public void setStateProvider(StateProvider stateProvider){ this.stateProvider = stateProvider; }
thanks
java spring spring-aop spring-boot aspectj
francis
source share