springframework 5.0.4.RELEASE无法识别@Configuration注释

问题描述 投票:0回答:1

到目前为止,我一直在使用springframework版本5.0.2.RELEASE。但最近,我切换到更新版本5.0.4.RELEASE。但是,在切换JAR之后,@ Configuration配置注释在我的项目中不会被识别为预定义注释。 Eclipse问我是否想要创建它。在弹簧框架的5.0.4.REL版本中是否有任何变化,这将停止识别@Configuration注释?

我的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>

使用@Configuration注释时出错:enter image description here

仅仅将我的POM文件中的springframework版本从5.0.4.REL修改为5.0.2.REL,我的eclipse项目开始识别@Configuration注释。

spring maven
1个回答
1
投票

删除/清除.m2目录,并再次加载maven文件以获取新的spring版本

© www.soinside.com 2019 - 2024. All rights reserved.