Consider renaming one of the beans or enabling overriding by setting spring

我想给项目加个easypoi
在pom.xml中加入依赖



    cn.afterturn
    easypoi-spring-boot-starter
    3.3.0

或者引入下面的依赖:


    cn.afterturn
    easypoi-base
    3.0.3


    cn.afterturn
    easypoi-web
    3.0.3


    cn.afterturn
    easypoi-annotation
    3.0.3

因为这个项目是springboot的 所以先加的easypoi-spring-boot-starter然后将easypoi相关的方法都弄完,启动项目失败,失败信息如下

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-04-30 09:56:52.017 ERROR 11044 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

The bean 'beanNameViewResolver', defined in class path resource [cn/afterturn/easypoi/configuration/EasyPoiAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class] and overriding is disabled.

Action:

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

一开始我以为加入的easypoi方法中重名了,或是创建了相同名字的bean,检查许久,然后我把剩下的依赖也给引进了


    cn.afterturn
    easypoi-base
    3.0.3


    cn.afterturn
    easypoi-web
    3.0.3


    cn.afterturn
    easypoi-annotation
    3.0.3

项目也还是启动失败。
请原谅我的菜,我将我新加入项目中的东西挨个试,最终发现 是依赖的问题,因为我是springboot项目 所以先入为主,认为这个依赖是没问题的,把这个依赖去掉,使用其他依赖,就没问题了,希望有大神来解释下吧



    cn.afterturn
    easypoi-spring-boot-starter
    3.3.0

你可能感兴趣的:(easypoi)