Spring Boot 应用启动失败是开发与运维的高频痛点。本文从 Bean 创建失败、循环依赖、自动配置冲突等典型场景出发,系统梳理排查方法论,涵盖报错解读、条件注解调试、自动配置排除等核心技巧,帮助你在 5 分钟内定位 90% 的启动失败问题。
一、问题背景
某次发版部署后,Spring Boot 应用启动失败,日志输出:
***************************
APPLICATION FAILED TO START
***************************
Description:
The dependencies of some of the beans in the application context form a cycle:
┌─────┐
| orderService (com.example.service.OrderService)
↑ ↓
| userService (com.example.service.UserService)
└─────┘
Action:
Relying upon circular references is discouraged and they are prohibited by default.
2026/7/3大约 14 分钟