DevdattaK
DevdattaK

Reputation: 198

@Configuration annotation is not recognized with springframework 5.0.4.RELEASE

I had been using springframework version 5.0.2.RELEASE so far. But recently, i switched to newer version 5.0.4.RELEASE. However, after this switch of JARs, @Configuration annotation is not recognized as predefined annotation in my project. Eclipse is asking me if i would like to create it. Is there any change in 5.0.4.REL version of springframework, which would stop recognizing the @Configuration annotation?

My POM :

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.drk.demo</groupId>
    <artifactId>springsecurity</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>springsecurity Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <springframework.version>5.0.4.RELEASE</springframework.version>
        <springsecurity.version>5.0.2.RELEASE</springsecurity.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <!-- Servlet, JSP and JSTL support -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>javax.servlet.jsp-api</artifactId>
            <version>2.3.1</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${springframework.version}</version>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${springsecurity.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${springsecurity.version}</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>springsecurity</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

Error while using the @Configuration annotation : enter image description here

With mere change of modifying the springframework version in my POM file from 5.0.4.REL to 5.0.2.REL, my eclipse project starts to recognize the @Configuration annotation.

Upvotes: 0

Views: 656

Answers (1)

surya
surya

Reputation: 2749

delete /clean your .m2 directory , and load maven file again for new spring version

Upvotes: 1

Related Questions