Spring 실행시 다음과 같은 에러가 났다

NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable

 

pom.xml 파일에서 hierachy를 살펴보니. Spring Batch 를 사용하면서 Spring 하위 버전을 쓰는 부분 떄문에 conflict 가 발생하고, Spring 이 하위버전으로 자동 resolve되었다.

 

 

아래와 같이 Spring Batch 사용시 Spring 관련 lib에 대해서 exclusion하니 작동이 되었다.

 

 

<dependency>
            <groupId>org.springframework.batch</groupId>
            <artifactId>spring-batch-infrastructure</artifactId>
            <version>${spring.batch.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-aop</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-beans</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-context</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-jdbc</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-test</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-tx</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

 

        <dependency>
            <groupId>org.springframework.batch</groupId>
            <artifactId>spring-batch-core</artifactId>
            <version>${spring.batch.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-aop</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-beans</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-context</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-jdbc</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-test</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                      <artifactId>spring-tx</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

Posted by '김용환'
,