在一次启动中遇到了bean冲突的问题,提示存在两个名称重复的bean
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.test.api.Application]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'healthCheckController' for bean class [com.test.datahub.controller.HealthCheckController] conflicts with existing, non-compatible bean definition of same name and class [com.test.api.controller.HealthCheckController]
项目中包括多个模块,其中A、B两个模块都有同一个类:HealthCheckController,检查更改信息发现,不知道谁在A模块添加了B模块的依赖,造成了这一问题,删除后解决
<dependency>
<groupId>com.test</groupId>
<artifactId>B</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>