天天看点

Java添加构造方法异常异常——Could not autowire. there is more than one bean of '' type

在写一个Test类的时候,为这个Test天加一个带参构造方法,但是对构造方法的入参提示:

Could not autowire. there is more than one bean of '' type

开始有点摸不着头脑,后面仔细一想, 难道是影响这个类在其他地方注入了? 注入默认都是用的无参构造方法。 于是自己在加了一个无参构造方法,问题解决!

Java添加构造方法异常异常——Could not autowire. there is more than one bean of '' type