sunmingtao / sample-code

3 stars 4 forks source link

Spring boot whitelabel error page #243

Closed sunmingtao closed 3 years ago

sunmingtao commented 3 years ago

Standard spring boot settings

image

Controller:

@Controller
public class HomeController {
    @GetMapping("/greeting")
    @ResponseBody
    public String home() {
        return "Welcome";
    }
}

Access http://localhost:8080/greeting sees whitelabel error page.

image

sunmingtao commented 3 years ago

Turns out when I used springboot cli to create the project skeleton, the default package is com.example. Then I changed it to com.smt. However, I forgot to change the package name in the main Spring boot class. Oddly, it is not a compilation error, just a warning complained by Intellij. Fixing the package name fixed the error