Home > OS >  Unable to get the auto-suggestion for annotations for springframework inspite of using the dependenc
Unable to get the auto-suggestion for annotations for springframework inspite of using the dependenc

Time:07-17

I have create a spring project from spring initializer and have imported it to IntelliJ, have included the Web dependency while creation but i am not getting the auto suggestions for annotations though pom.xml has the dependency for it.

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

I tried by restarting and loading the maven but still it doesnot work. Need certain assistance over here.

CodePudding user response:

Can you show us your whole POM.XML file please? Are you sure that you have implemented the Spring Web dependency? Below I am showing you the XML code for Spring Web dependency. The aforementioned above is the test that it is being automatically provided in the Spring Project.

Furthermore please consider to reload your maven project for the dependencies to be applied.

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

CodePudding user response:

<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>
  • Related