필자는 WebGUI 및 REST 서비스를 통해 액세스 할 수 있어야하는 스프링 애플리케이션을 개발해야한다. 이제 스프링 MVC 예제를 살펴 보았습니다. 스프링 MVC에 대한 안녕 세계 튜토리얼은 this입니다. 휴식 용 인터페이스가있는 Spring Mvc 웹 애플리케이션
@Controller
@RequestMapping("/welcome")
public class HelloController {
@RequestMapping(method = RequestMethod.GET)
public String printWelcome(ModelMap model) {
model.addAttribute("message", "Spring 3 MVC Hello World");
return "hello";
}
}
그런 다음 나는이처럼 보이는
Spring REST example을 통해 보았다 : 다음과 같은
컨트롤러 보인다 나는이 두 사례를 어떻게 (스프링 MVC를 궁금
이제@Controller
@RequestMapping("/movie")
public class MovieController {
@RequestMapping(value = "/{name}", method = RequestMethod.GET)
public String getMovie(@PathVariable String name, ModelMap model) {
model.addAttribute("movie", name);
return "list";
}
@RequestMapping(value = "/", method = RequestMethod.GET)
public String getDefaultMovie(ModelMap model) {
model.addAttribute("movie", "this is default movie");
return "list";
}
}
스프링 - 휴식)이 다른가요? 둘 다 동일한 주석을 사용하고 비슷하게 작동합니다. 둘 다 REST 예제가 아닌가?
어떻게 Spring-MVC 애플리케이션에 Rest-Interface를 제공 할 수 있습니까?
관련
RESTful 인 서비스는 리소스에 액세스하는 방법과 관련이 있습니다. 참조 : https://en.wikipedia.org/wiki/Representational_state_transfer#RESTful_web_APIs – Aurand