今天写代码遇到的问题
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2026-01-16 23:10:59.793 [main] ERROR o.s.b.diagnostics.LoggingFailureAnalysisReporter-
***************************
APPLICATION FAILED TO START
***************************
Description:
The dependencies of some of the beans in the application context form a cycle:
clazzController (field private com.itheima.service.ClazzService com.itheima.controller.ClazzController.clazzService)
┌─────┐
| clazzServiceImpl (field private com.itheima.service.StudentService com.itheima.service.impl.ClazzServiceImpl.studentService)
↑ ↓
| studentServiceImpl (field private com.itheima.service.ClazzService com.itheima.service.impl.StudentServiceImpl.clazzService)
└─────┘
Action:
Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.
Disconnected from the target VM, address: '127.0.0.1:14901', transport: 'socket'
Process finished with exit code 1
最后一顿排查是因为循环依赖了,就是A依赖B,B又依赖A,导致项目起不起来
解决方法就是修改依赖,比如service调用mapper层来解决