Spring boot 项目启动的时候,报错了...
说是Bean重复了,建议设置
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
但是,其实我是设置了,狗摆,但是依旧报这个错;
。。。
所以,如果你也是设置了,但是没有生效,可以试试我这个,如果你还没有设置,就到项目启动文件里(就是类似bootstrap.yaml或者application.yml)把上面提到的配置(spring.main.allow-bean-definition-overriding=true)加进去,然后重启试试;
如果你设置了,但是还是没有生效,就可以试试我下面的方法(邪恶了。。。。):
public static void main(String[] args) {
SpringApplication app = new SpringApplication(MyApplication.class);
app.setAllowBeanDefinitionOverriding(true);
app.run(args);
}
其实就是不知道为啥我在项目启动配置文件里的配置为啥没生效,索性我就直接显示设置了一把;
low是low了点,但是效果杠杆的。