It shows:
Request Mapping can not be resolved to a type.
CodePudding user response:
In Eclipse IDE sometimes this error comes while using Java 1.8. To resolve this error you have to perform 2 actions:-
- Modify Build Path:- The tools.jar file in the lib folder of Java1.8 needs be to added as additional JARs. See steps here. Go to Project => Properties => Java Build Path => Libraries => JRE System Libraries => Edit. Click Alternative JRE => Installed JREs => click on jre1.8 => Edit. In Edit JRE windows, add extranal JAR "tools.jar" from the JDK installation path => Apply and close.
- Modify Project Facets:- Go to Project => Properties => Project Facets => Adjust the Java version => Click on Apply.
CodePudding user response:
You should define HTTP method type, Get, post, put etc. As below
@RequestMapping(value = "/hello", method = RequestMethod.GET)