У меня есть 2 метода в моем весеннем контроллер загрузки RESTSpring GET и PATCH запрос
вот мой REST код CONTROLLER
@RestController
public class MainRestController {
@RequestMapping(value = "/",method=RequestMethod.POST)
public String startMigration(){
return "POSt";
}
@RequestMapping(value = "/",method=RequestMethod.PATCH)
public String PUT(){
return "PUT";
}
/*
* If i commnet this method and un comment following method it will run
* */
@RequestMapping(value = "/{name}",method=RequestMethod.PUT)
public String PATCH(@PathVariable String name){
return "PATCH";
}
/*@RequestMapping(value = "/",method=RequestMethod.PATCH)
public String PATCH(){
return "PATCH";
}*/
@RequestMapping(value = "/",method=RequestMethod.DELETE)
public String DELETE(){
return "DELETE";
}
}
и вот мой CONTROLLER код
@Controller
public class MainController {
@RequestMapping(value = "/",method=RequestMethod.GET)
public String getMainPage(){
return "index.html";
}
}
Теперь вопрос когда я нахожу запрос PATCH http://localhost:8080/ it return
{
"timestamp": 1486041782895,
"status": 405,
"error": "Method Not Allowed",
"exception":"org.springframework.web.HttpRequestMethodNotSupportedException",
"message": "Request method 'PATCH' not supported",
"path": "/"
}
и когда я ударил запрос GET http://localhost:8080/ это вернуть
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Feb 02 19:00:18 IST 2017
There was an unexpected error (type=Method Not Allowed, status=405).
Request method 'GET' not supported
может кто-нибудь сказать мне причину?
Можете ли вы добавить образец, демонстрирующий приложение SB? – dmahapatro
Я добавил свой код класса – atiwari54