简体   繁体   中英

Spring Boot - RequestMapping not working in RestController

I´m building a Rest login service but when I tried to access the landing page I get this:

{
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/profile"
    }
  }
}

The RestController code in really simple

@RestController
public class MainController {

private VoterAcces voterAccess;

@RequestMapping("/")
public String landing() {
    return "Landing page por Voters System";
}

@RequestMapping(value = "/user", method = RequestMethod.POST)
@ResponseBody
public Object getVI(@RequestBody UserInfo userInfo) {
    return this.voterAccess.getUser(userInfo.getEmail(), userInfo.getPassword());

}

Im not really sure why I get that and not the String "Landing page por Voters System"

Try to turn off static resource handling:

spring.resources.add-mappings=false # Disable default resource handling.

More info can be found in properties section of Spring Boot .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM