The bean xxx could not be registered. A bean with that name has already been defined and overriding

错误截图:
The bean xxx could not be registered. A bean with that name has already been defined and overriding_第1张图片
现在该服务名已经被使用过了,

解决方法:
在配置文件中加一段配置

spring.
	main:
    	allow-bean-definition-overriding: true

在这里插入图片描述
我这里是在.yml文件中,properties文件改为spring.main.allow-bean-definition-overriding= true

结果:
在这里插入图片描述

运行正常!

你可能感兴趣的:(Spring,java)