0

When I click the import maven dependency in the pop up shown at RequestMapping, intellij adds

<dependency>
    <groupId>org.springframework</groupId>   
    <artifactId>spring-web</artifactId>
    <version>5.1.10.RELEASE</version>
</dependency>

But it should add this.

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

How can I resolve this? I have auto-import enabled for maven and I have tried both the maven bundled version with IntelliJ and the manually downloaded version. Changing the dependency manually makes the program run correctly.

Error in @RequestMapping

3
  • 1
    It will find the dependency that contains that class. Which is spring-web and not the spring-boot-starter-web (as the latter is just a BOM containoing other dependencies). Commented Oct 7, 2019 at 6:06
  • 1
    Everything is ok. Spring Boot Starter dependencies are meant to be added manually or using start.spring.io. Commented Oct 7, 2019 at 6:09
  • @M.Deinum Where can I find more about them? Commented Oct 7, 2019 at 9:07

1 Answer 1

1

Open pom.xml

Remove the below dependency :

<dependency>
    <groupId>org.springframework</groupId>   
    <artifactId>spring-web</artifactId>
    <version>5.1.10.RELEASE</version>
</dependency>

and add this :

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.