启动项目,报下面的错误
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-11-28 16:39:56 | ERROR | main | org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter |
***************************
APPLICATION FAILED TO START
***************************
Description:
Field toolbarButtonService in com.spek.common.script.ScriptController required a single bean, but 2 were found:
- sysControlToolbarButtonService: defined in file [G:\workplace\work\common\spek-common-module\target\classes\com\spek\common\modules\control\toolbar\service\impl\SysControlToolbarButtonServiceImpl.class]
- ISysControlToolbarButtonService: defined in file [G:\workplace\work\common\spek-common-module\target\classes\com\spek\common\modules\control\toolbar\service\ISysControlToolbarButtonService.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:64850', transport: 'socket'
service 接口层定义如下
public interface ISysControlToolbarService extends BaseService<SysControlToolbar> {
void save(SysControlToolbar tbar, List<SysControlToolbarButton> buttons);
}
service实现类定义如下
@Service("sysControlToolbarService")
public class SysControlToolbarServiceImpl extends BaseServiceImpl<SysControlToolbarRepository, SysControlToolbar>
implements ISysControlToolbarService {
}
分析问题:
这是普通的注入一个接口,目前工程只有一个实现类,为什么会爆出required a single bean, but 2 were found 问题呢?
使用的工具IDEA 2017.2.5 ,但是在eclipse中启动倒是没有这样的异常?
请问如何解决
版权声明:本文为qq_39609151原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。