新手上路遇到的Whitelabel Error Page解决方案

新手上路遇到的Whitelabel Error Page解决方案

代码:

package com.example.demo.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    @RequestMapping("/hello")
    public String hello() {
        return "Hello Spring Boot!";
    }
}

访问localhost:8080/hello

原因:程序只加载Application.java所在包及其子包下的内容

把web包移动到如上位置,再次访问

成功!

猜你喜欢

转载自www.cnblogs.com/mengxiaoleng/p/12170440.html