一、报错:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-12-22 20:28:03.186 ERROR 1492 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
The dependencies of some of the beans in the application context form a cycle:
mallSalesController defined in file [D:\Data\GitLab\badger-brand-cloud\badger-brand-admin\badger-brand-admin-server\target\classes\com\badger\controller\MallSalesController.class]
┌─────┐
| mallSalesServiceImpl defined in file [D:\Data\GitLab\badger-brand-cloud\badger-brand-admin\badger-brand-admin-server\target\classes\com\badger\service\impl\MallSalesServiceImpl.class]
↑ ↓
| sysBrandMallServiceImpl defined in file [D:\Data\GitLab\badger-brand-cloud\badger-brand-admin\badger-brand-admin-server\target\classes\com\badger\service\impl\SysBrandMallServiceImpl.class]
└─────┘
Disconnected from the target VM, address: '127.0.0.1:65479', transport: 'socket'
Process finished with exit code 1
二、原因:使用lombok的@AllArgsConstructor,循环依赖
三、解决办法
1、使用@AutoWired
二、使用@AllArgsConstructor(onConstructor_ = {@Lazy, @Autowired})