版权声明:本文为博主原创文章,经博主允许,可自由共享,尽量不要用于商业用途。 https://blog.csdn.net/matrixbbs/article/details/88104964
初学,新建一个项目
工具:STS
new Spring Starter Project
Group:com.zfh.demo
Restful->web->finish
加入一个包controller
创建一个class,然后注解为一个控制器
@RestController
//@RequestMapping(value = "/index")
public class IndexController {
@RequestMapping("/hello")
public String index() {
return "hello world";
}
}
结果遇到如下出错提示
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon Mar 04 10:42:27 CST 2019
There was an unexpected error (type=Not Found, status=404).
No message available
调整项目目录层级
最终解决问题