Issue
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.Getmapping;
@Controller
public class HomeController {
@GetMapping("/")
public String home(){
return "hone";
}
}
I just can't import org.springframework.web so that I can't use @GetMapping.
How to solve this problem?
Should I add more dependencies?
Solution
Add spring-web
module to your classpath.
Gradle
compile group: 'org.springframework', name: 'spring-web', version: '5.2.6.RELEASE'
Maven
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>
Answered By - Minar Mahmud
Answer Checked By - David Marino (JavaFixing Volunteer)