使用的是 spring cloud alibaba 2021.0.1 + spring boot 2.6.4 目录布局: 1、common模块:存放 model、mapper、service、impl、连接数据库、统一异常处理、redis josn数据格式化、统一响应、swagger、mp、cors 2、merchant模块(商户端):主要编辑controller对外开放api接口 3、supply模块(供货商):主要编辑controller对外开放api接口 问题描述: 目前在做 merchant模块,启动时提示错误: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springApplicationAdminRegistrar' defined in class path resource [org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Admin,name=SpringApplication  尝试3~5小时没解决,特来思否求助大佬们 特别描述: 1、目前swagger2实际测试成功。将swagger2全部内容放到common模块,在商户端编写controller时,进行添加注解接口:启动 swagger2可以显示商户端的端口中打开文档地址显示controller中定义的接口文档 尝试失败过的方法: 1、在启动类上加包扫描:结果失败,提示另一个错误 // @SpringBootApplication @SpringBootApplication(scanBasePackages = "com.quanneng") @Slf4j @MapperScan("com.quanneng.mapper") public class MerchantApiApplication { …… } Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springApplicationAdminRegistrar' defined in class path resource [org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Admin,name=SpringApplication \-->后百度,解决无果 2、尝试 @ComponentScan({"com.*"}) public class MerchantApiApplication { …… } Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'merchantController': Unsatisfied dependency expressed through field 'merchantService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'merchantService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'merchantMapper' defined in file [D:\biancheng\git_cangku_java_spring_cloud_alibaba\liuliang_mall_java\common\target\classes\com\quanneng\mapper\MerchantMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required \-->配置了 mybatisPlusConfig 无果、添加 datasource 到 merchant 模块yml文件 无果。