Languages

Spring Boot 3 - "Whitelabel Error Page" getting in new project

6 points
Asked by:
Emrys-Li
580

Any Idea why new Spring Boot 3 project return "Whitelabel Error Page" when I open http://localhost:8080 in the web browser?

Whitelabel Error Page in Spring Boot 3.
Whitelabel Error Page in Spring Boot 3.
1 answer
3 points
Answered by:
Emrys-Li
580

It looks like you don't have defined mappings.

e.g. src/main/java/com/example/demo/MainController.java file:

package com.example.demo;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class MainController {

    @RequestMapping(
        value = "/",
        method = RequestMethod.GET
    )
    @ResponseBody
    public String index() {
        return "Hi There!";
    }
}

 

0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join