java.lang.NoClassDefFoundError: org/springframework/beans/factory/NoUniqueBeanDefinitionException

狂风中的少年 提交于 2019-11-29 03:14:10

You seem to be missing spring beans artifacts in your references. add the following to pom dependencies:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>3.2.2.RELEASE</version>
</dependency>

This error also occurs if you have a conflict of versions. For instance you might use spring-context in version 3.2.3.RELEASE which depends on spring-beans 3.2.3.RELEASE and in the same program use spring-batch 2.2.2.RELEASE which depends on spring-beans 3.2.0.RELEASE (note the difference in version numbers.) In that case you will have to analyze dependencies (using, for instance, Eclipses pom editor) and exclude the offending versions. In my case that would mean adding:

<dependency>
    <groupId>org.springframework.batch</groupId>
    <artifactId>spring-batch-core</artifactId>
    <version>2.2.2.RELEASE</version>
    <exclusions>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </exclusion>
    </exclusions>
</dependency>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!