再spring项目运行时的报错信息
Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘invoiceTaskService’: Requested bean is currently in creation: Is there an unresolvable circular reference?
发生这个问题的原因时spring不支持循环调用
两种解决办法:
方法一:
使用@lazy注解 (此方法有效)
在循环调用invoiceTaskService 的位置加上@lazy
方法二:
在配置文件中允许循环依赖 (此方法试过没效)