I have been looking around here and in other forums for hours and I still haven’t found what I am doing wrong. I have built a simple Spring-Boot application with MongoDB and I have no errors in the console when i run it but i keep getting the white label error no matter what I do. My main and controller classes are in different packages but I have used @ComponentScan. I have also added web app folder thinking it would fix it but apparently that wasn’t the issue. I have also added all the necessary mappings to the controller class. These are the most common solutions I’ve seen but I still get the same error.
<?xml version="1.0" encoding="UTF-8"?>
4.0.0 org.springframework.boot spring-boot-starter-parent 2.3.5.RELEASE com.example Kamerat 0.0.1-SNAPSHOT Kamerat Demo project for Spring Boot
<properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
Screenshot of Controller class
Advertisement
Answer
You are having this error because there is no defaut webPage for spring boot Screenshot with the error
To fix it , you just need to add a simple html file (index.html) in you sr/main/resources/statics directory
Screenshot of the config to do
Then you will have :