报错问题:

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

Description:

The bean 'restTemplate', defined in class path resource [com/tanhua/server/config/RestTemplateConfig.class], could not be registered. A bean with that name has already been defined in class path resource [com/tanhua/server/config/Config.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

 

出现以上报错时,可在配置文件中添加如下配置:

1:yml格式:

#当出现相同名字的类进行注册时,准许覆盖注册

spring:

    main:

        allow-bean-definition-overriding: true

 

2.properties格式:
#当出现相同名字的类进行注册时,准许覆盖注册
spring.main.allow-bean-definition-overriding=true

 

更多推荐

解决:Consider renaming one of the beans or enabling overriding by setting spring.m