Spring Web Dependency

OPEN https://start.spring.io/

Unzip the downloaded JAR

Open Project from File System.

Take a look at how Project looks (pom.xml) and project structure.

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-test</artifactId>
	<scope>test</scope>
</dependency>

Run the application (Tomcat Server is built in here).

Call localhost:8080 on your browser (without running this program). You will get standard error as below.

Now run the program. And hit the browser again.

Spring Boot is doing something but error is not mapped. Notice status 404. Customized error message from Spring Boot Framework. SOLUTION? Create error.html in <your project>/src/main/resources/static/error/ folder. Write your own custom message there. Re-start application and hit localhost:8080 once again.

But this doesn’t solve the problem. Spring Boot Framework expects developer to create own HTML file as well as own controller so that it can show the desired page.


Above picture shows display of home.html on hitting localhost:8080

Congratulations! You have successfully created your hello world Spring Boot Web application.