1. 循环引用报错
The dependencies of some of the beans in the application context form a cycle:
┌─────┐
| org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration
↑ ↓
| filterChain defined in class path resource [com/nextera/boot4/config/SecurityConfig.class]
└─────┘
2. 解决方法:
直接在application.properties
spring.main.allow-circular-references = true
3、更彻底的解决方法
找出依赖关系,不要@Autowired, 通过构造注入, 或者
@RequiredArgsConstructor,@Lazy,避免
循环引用。