spring autowired aop circular dependency

后端 未结 4 442
萌比男神i
萌比男神i 2021-01-31 09:07

I\'m using java config with @ComponentScanin order to initialize my beans and @EnableAspectJAutoProxy(proxyTargetClass=true)to use cglib proxies.

4条回答
  •  Happy的楠姐
    2021-01-31 09:33

    AsyncConfigurer configuration classes get initialized early in the application context bootstrap. If you need any dependencies on other beans there, make sure to declare them 'lazy' as far as possible in order to let them go through other post-processors as well.

    Reference JavaDoc: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/scheduling/annotation/EnableAsync.html

提交回复
热议问题