【发布时间】:2018-10-18 22:05:00
【问题描述】:
我正在使用带有此代码的 Spring Boot 版本 1.5.10.RELEASE(最新版本之一):
@Service
public class AService {
private AService aService; //Self autowire
public AService(AService aService){
this.aService = aService;
}
@Cacheable(value = "aCacheName")
public List<SomeClass> expensiveOperation(){
//Very expensive operation that can be cached
}
public List<SomeClass> otherOperation(){
return aService.expensiveOperation().otherOperation()); //Call proxy, can't use this.expensiveOperation() because it will bypass the cache
}
}
我收到此错误:
“应用上下文中一些bean的依赖形成了一个循环。”
我知道 Spring 允许“自我自动装配”,我做错了什么?
谢谢。
【问题讨论】:
标签: spring spring-boot ioc-container