Starting Spring Boot Application
Last Updated: February 28, 2018
First I will create the Maven Java Application using Netbean IDE.
Under the Project Files, you can see pom.xml
file where you can add the project dependencies and and parent tag.
So your final pom.xml
should be like this
4.0.0 com.codekayak BootStart 1.0-SNAPSHOT jar UTF-8 1.8 1.8 org.springframework.boot spring-boot-starter-parent 1.5.9.RELEASE org.springframework.boot spring-boot-starter-web 1.5.9.RELEASE
Next, you can create the Test.java
class and add the following code to it
package com.codekayak.bootstart; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Test { public static void main(String[] args) { SpringApplication.run(Test.class,args); } }
Annotaion @SpringBootApplication
tells to Spring that this is a Spring Boot application
Now you can build the application and run it
When you look at the console log of the Netbeans IDE you can see the Tomcat started on port(s): 8080 (http). This means we have build the stand alone application and we did not deploy it to Tomcat webserver.
So you can open this URL http://localhost:8080/
in your browser