为了账号安全,请及时绑定邮箱和手机立即绑定

springboot项目添加了拦截器的注解(注册过滤器注解)(@ServletComponentScan)之后启动就报错

springboot项目添加了拦截器的注解(注册过滤器注解)(@ServletComponentScan)之后启动就报错

黄志荣 2019-06-04 16:49:40
  .   ____          _            __ _ _ /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/  ___)| |_)| | | | | || (_| |  ) ) ) )  '  |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot ::        (v2.1.5.RELEASE)2019-06-04 16:44:51.500  INFO 15848 --- [           main] com.hzr.demo2.Demo2Application           : Starting Demo2Application on PC-201705061124 with PID 15848 (D:\321\demo2\target\classes started by Administrator in D:\321\demo2)2019-06-04 16:44:51.502  INFO 15848 --- [           main] com.hzr.demo2.Demo2Application           : No active profile set, falling back to default profiles: default2019-06-04 16:44:52.117  WARN 15848 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'channelFilter' defined in null: Cannot register bean definition [Root bean: class [org.springframework.boot.web.servlet.FilterRegistrationBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] for bean 'channelFilter': There is already [Generic bean: class [com.hzr.demo2.filter.ChannelFilter]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [D:\321\demo2\target\classes\com\hzr\demo2\filter\ChannelFilter.class]] bound.2019-06-04 16:44:52.126  INFO 15848 --- [           main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.2019-06-04 16:44:52.128 ERROR 15848 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : ***************************APPLICATION FAILED TO START***************************Description:The bean 'channelFilter', defined in null, could not be registered. A bean with that name has already been defined in file [D:\321\demo2\target\classes\com\hzr\demo2\filter\ChannelFilter.class] and overriding is disabled.Action:Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=trueProcess finished with exit code 1
查看完整描述

3 回答

?
乌云下的风

TA贡献40条经验 获得超10个赞

希望同学能把源码贴出来,方便参考

查看完整回答
反对 回复 2019-06-28
  • 3 回答
  • 0 关注
  • 3462 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信