required a single , but 2 were found
Error:
Error:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field messageService in com.sto.unify.app.jnv2.controller.biz.TaskCenter.TaskCenterController required a single bean, but 2 were found:
- taskMessageServiceImpl: defined in file [/Users/zgz/IdeaProjects/sto-app-face/sto-app-face-jn/sto-app-face-jn-service/target/classes/com/sto/unify/app/jnv2/service/core/task/impl/TaskMessageServiceImpl.class]
- taskMessageService: defined in file [/Users/zgz/IdeaProjects/sto-app-face/sto-app-face-jn/sto-app-face-jn-service/target/classes/com/sto/unify/app/jnv2/service/core/task/TaskMessageService.class]
Action:
Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed
Error reason:
It may be that maperscan scans all the packages during scanning. Change it to the following
Similar Posts:
- [Solved] The swagger UI dependency is introduced into spring boot Error
- [Solved] expected single matching bean but found 2
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.southwind.mmall002.service.Impl.ProductCategoryServiceImplTest’:
- SpringBoot+Mybatis-plus multi-module project startup Error: xxxmapper or basemapper cannot be found
- [Solved] Springboot Error: Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
- [Solved] ShardingJDBC Error: The bean ‘dataSource’, defined in class path resource [org/apache/shardingsphere/shardingjdbc/spring/boot/SpringBootConfiguration.class], could not be registered.
- [Solved] springboot Startup Error: Bean with name ‘xxxxService‘ has been injected into other beans
- Container Cannot Find bean, Field usersMapper in com.imooc.impl.UserServiceImpl required a bean of type ‘com.imooc.mapper.UsersMapper’ that could not be found.
- Springcloud: gateway module startup error
- mybatis: Property ‘configuration’ and ‘configLocation’ can not specified with together