我是靠谱客的博主 感性饼干,最近开发中收集的这篇文章主要介绍【报错】:required a single bean, but 2 were found,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in com.fangly.upms.impl.controller.SysMenuController required a single bean, but 2 were found:
	- sysMenuServiceImpl: defined in file [D:myProjectfangly-scafford-projectfangly-scaffoldfangly-upmsfangly-upms-impltargetclassescomfanglyupmsimplserviceimplSysMenuServiceImpl.class]
	- sysMenuService: defined in file [D:myProjectfangly-scafford-projectfangly-scaffoldfangly-upmsfangly-upms-impltargetclassescomfanglyupmsimplserviceSysMenuService.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

Disconnected from the target VM, address: '127.0.0.1:64008', transport: 'socket'

Process finished with exit code 1

搭项目的时候遇到报错,觉得很奇怪,然后进行问题排查,发现是@mapperScan的扫描范围过大导致,把扫描范围改小就好了。

将其改为:

@MapperScan("com.fangly.upms.impl.mapper")

报错消失。

最后

以上就是感性饼干为你收集整理的【报错】:required a single bean, but 2 were found的全部内容,希望文章能够帮你解决【报错】:required a single bean, but 2 were found所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部