无法获得springframework注释的自动建议,尽管使用了依赖项



我已经从spring初始化器创建了一个spring项目,并将其导入到IntelliJ,在创建时包含了Web依赖项,但我没有得到注释的自动建议,尽管pom.xml有对它的依赖。

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

我尝试重新启动和加载maven,但它仍然不工作。这里需要一些帮助。

您能给我们看一下您的整个POM.XML文件吗?您确定已经实现了Spring Web依赖关系吗?下面我将展示Spring Web依赖项的XML代码。上面提到的是Spring项目中自动提供的测试。

此外,请考虑重新加载maven项目以获得要应用的依赖项。

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

最新更新