content
1. Problems
When refactoring the code, I encountered a problem. The basic implementation class I wrote was inherited by multiple classes. Let's modify it according to the error prompt.
Field mapper in com.move.exam.app.service.base.BaseServiceImpl required a single bean, but 5 were found: - pageHelperProperties: defined by method 'pageHelperProperties' in class path resource [com/github/pagehelper/autoconfigure/PageHelperAutoConfiguration.class] - systemProperties: a programmatically registered singleton - systemEnvironment: a programmatically registered singleton - contextParameters: a programmatically registered singleton - contextAttributes: a programmatically registered singleton 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 com中的字段映射器。移动考试应用程序。服务基础BaseServiceImpl需要一个bean,但找到了5个: -pageHelperProperties:由类路径资源[com/github/pagehelper/autoconfigure/PageHelperAutoConfiguration.class]中的方法“pageHelperProperties”定义 -systemProperties:编程注册的singleton-systemEnvironment:编程注册的singleton-contextParameters:编程注册的singleton-contextAttributes:编程注册的singleton 行动: 考虑将其中一个bean标记为@Primary, 更新消费者以接受多个bean, 或者使用@Qualifier来标识应该使用的bean
Second, the solution
给其中一个实现类添加@Primary标记为默认初始化的类即可
Field mapper in xxxServiceImpl required a single bean, but 5 were found:
Guess you like
Origin blog.csdn.net/libusi001/article/details/124417676
Ranking