springboot在配置Bean的时候,可能会出现这样的错误!!! 原因是因为相同名字的bean已经存在了。
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'interceprot', defined in class path resource [com/example/demo1/doInterceptor.class], could not be registered. A bean with that name has already been defined in file [/Users/sun/Desktop/demo1/target/classes/com/example/demo1/Interceprot.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
要是想配置成功,需要在配置文件中加上这样一段
spring.main.allow-bean-definition-overriding=true
意思是覆盖bean。 这样就好了!!!!