比如在浏览器输入http://localhost:8078/hello/helloword访问的是后端的
@RestController
@RequestMapping("/hello")
public class HelloWord {
@RequestMapping("/helloword")
public String helloWord(){
return "hello word";
}
}
浏览器将会返回

本文详细描述了如何在SpringMVC框架中创建一个简单的RESTfulAPI,通过`@RestController`和`@RequestMapping`注解处理来自浏览器的/hellowordGET请求,返回helloword响应。
比如在浏览器输入http://localhost:8078/hello/helloword访问的是后端的
@RestController
@RequestMapping("/hello")
public class HelloWord {
@RequestMapping("/helloword")
public String helloWord(){
return "hello word";
}
}
浏览器将会返回

4662
7701
9923
1036
1490
2859

被折叠的 条评论
为什么被折叠?
