• Java
    • JAXB Tutorial
      • What is JAXB
      • JAXB Marshalling Example
      • JAXB UnMarshalling Example
  • Spring Tutorial
    • Spring Core Tutorial
    • Spring MVC Tutorial
      • Quick Start
        • Flow Diagram
        • Hello World Example
        • Form Handling Example
      • Handler Mapping
        • BeanNameUrlHandlerMapping
        • ControllerClassNameHandlerMapping
        • SimpleUrlHandlerMapping
      • Validation & Exception Handling
        • Validation+Annotations
        • Validation+ResourceBundle
        • @ExceptionHandler
        • @ControllerAdvice
        • Custom Exception Handling
      • Form Tag Library
        • Textbox Example
        • TextArea Example
        • Password Example
        • Dropdown Box Example
        • Checkboxes Example
        • Radiobuttons Example
        • HiddenValue Example
      • Misc
        • Change Config file name
    • Spring Boot Tutorial
  • Hibernate Tutorial
  • REST Tutorial
    • JAX-RS REST @PathParam Example
    • JAX-RS REST @QueryParam Example
    • JAX-RS REST @DefaultValue Example
    • JAX-RS REST @Context Example
    • JAX-RS REST @MatrixParam Example
    • JAX-RS REST @FormParam Example
    • JAX-RS REST @Produces Example
    • JAX-RS REST @Consumes Example
    • JAX-RS REST @Produces both XML and JSON Example
    • JAX-RS REST @Consumes both XML and JSON Example
  • Miscellaneous
    • JSON Parser
      • Read a JSON file
      • Write JSON object to File
      • Read / Write JSON using GSON
      • Java Object to JSON using JAXB
    • CSV Parser
      • Read / Write CSV file
      • Read/Parse/Write CSV File – OpenCSV
      • Export data into a CSV File
      • CsvToBean and BeanToCsv – OpenCSV

JavaInterviewPoint

Java Development Tutorials

Spring Boot Hello World Example with Maven

February 27, 2017 by javainterviewpoint Leave a Comment

Spring Boot is developed as a subproject of spring framework in order to create a stand-alone application with minimum possible configuration. In this Spring Boot Hello World Example, we will build a simple hello world example using Spring boot with maven.

Spring Boot Hello World Example

Step 1: Preparation for Spring Boot application

As a first step, we need to validate whether Java and Maven are installed. Open command prompt and type “java -version” to check the Java version

E:\Jackson\SpringBootTutorial>java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) Client VM (build 24.80-b11, mixed mode, sharing)

“mvn -v” for checking the maven version.

E:\Jackson\SpringBootTutorial>mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:47+05:30)
Maven home: E:\Jackson\apache-maven-3.3.9
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.8.0_121\jre
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "dos"

Step 2: Create POM file and add dependencies

Create a project Folder “SpringBootTutorial” for placing the required files. Place pom.xml in the root folder itself. Spring Boot provides a number of “Starter POMs”, in our application we have used spring-boot-starter-parent in the parent section of the POM. The spring-boot-starter-parent is a special starter that provides useful Maven defaults. spring-boot-starter-parent has no dependencies by itself.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0	http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>

   <groupId>com.javainterviewpoint</groupId>
   <artifactId>SpringBootTutorial</artifactId>
   <version>0.0.1-SNAPSHOT</version>

   <parent>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-parent</artifactId>
     <version>1.5.1.RELEASE</version>
   </parent>
 </project>

Now when you run mvn dependency:tree you will not see any other jars other than our SpringBootTutorial SNAPSHOT jar.

E:\Jackson\SpringBootTutorial>mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringBootTutorial 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ SpringBootTutorial ---
[INFO] com.javainterviewpoint:SpringBootTutorial:jar:0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.524 s
[INFO] Finished at: 2017-02-19T15:32:47+05:30
[INFO] Final Memory: 14M/33M
[INFO] ------------------------------------------------------------------------

Since we are developing a web application, we also need to add spring-boot-starter-web dependency.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0	http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>

   <groupId>com.javainterviewpoint</groupId>
   <artifactId>SpringBootTutorial</artifactId>
   <version>0.0.1-SNAPSHOT</version>

   <parent>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-parent</artifactId>
     <version>1.5.1.RELEASE</version>
   </parent>
   
   <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
   </dependencies>
 </project>

Now when you run mvn dependency:tree you can see there will number of additional dependencies added including Tomcat, Jackson, Spring boot etc.

E:\Jackson\SpringBootTutorial>mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringBootTutorial 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ SpringBootTutorial ---
[INFO] com.javainterviewpoint:SpringBootTutorial:jar:0.0.1-SNAPSHOT
[INFO] \- org.springframework.boot:spring-boot-starter-web:jar:1.5.1.RELEASE:compile
[INFO]    +- org.springframework.boot:spring-boot-starter:jar:1.5.1.RELEASE:compile
[INFO]    |  +- org.springframework.boot:spring-boot:jar:1.5.1.RELEASE:compile
[INFO]    |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.1.RELEASE:compile
[INFO]    |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.1.RELEASE:compile
[INFO]    |  |  +- ch.qos.logback:logback-classic:jar:1.1.9:compile
[INFO]    |  |  |  +- ch.qos.logback:logback-core:jar:1.1.9:compile
[INFO]    |  |  |  \- org.slf4j:slf4j-api:jar:1.7.22:compile
[INFO]    |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.22:compile
[INFO]    |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.22:compile
[INFO]    |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.22:compile
[INFO]    |  +- org.springframework:spring-core:jar:4.3.6.RELEASE:compile
[INFO]    |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO]    +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.1.RELEASE:compile
[INFO]    |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.11:compile
[INFO]    |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.11:compile
[INFO]    |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.11:compile
[INFO]    +- org.hibernate:hibernate-validator:jar:5.3.4.Final:compile
[INFO]    |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO]    |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO]    |  \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO]    +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.6:compile
[INFO]    |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO]    |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile
[INFO]    +- org.springframework:spring-web:jar:4.3.6.RELEASE:compile
[INFO]    |  +- org.springframework:spring-aop:jar:4.3.6.RELEASE:compile
[INFO]    |  +- org.springframework:spring-beans:jar:4.3.6.RELEASE:compile
[INFO]    |  \- org.springframework:spring-context:jar:4.3.6.RELEASE:compile
[INFO]    \- org.springframework:spring-webmvc:jar:4.3.6.RELEASE:compile
[INFO]       \- org.springframework:spring-expression:jar:4.3.6.RELEASE:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.724 s
[INFO] Finished at: 2017-02-19T15:36:40+05:30
[INFO] Final Memory: 15M/38M
[INFO] ------------------------------------------------------------------------

Run “mvn package” command to create a package, now the folder structure will be

|-- pom.xml
|-- target
    |-- maven-archiver
    |   |-- pom.properties
    |-- SpringBootTutorial-0.0.1-SNAPSHOT.jar

Other interesting articles which you may like …

  • How to Create Deployable WAR | Spring Boot | SpringBootServletInitializer
  • Spring Boot CommandLineRunner and ApplicationRunner
  • Spring Boot – How to Change Embedded Tomcat default port
  • Spring Boot CRUDRepository Example- Spring Data JPA
  • Fix missing src/main/java folder in Eclipse Maven Project – 2 build path entries are missing
  • Spring MVC CRUD Example with MySql + JdbcTemplate
  • RESTful Java Client With Jersey Client
  • RESTEasy Hello World Example with Apache Tomcat
  • RESTful Java client with RESTEasy client
  • Spring RESTful Web Services Hello World XML Example
  • Springfox Swagger 2 for Spring RESTful Web Services

Step 3: Creation of the Java File

We will be having a single java file for our HelloWorld example. Maven by default will be compiling all the java files which are under src/main/java, hence we need to create our HelloWorld.java under src/main/java folder

package com.javainterviewpoint;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@EnableAutoConfiguration
public class HelloWorld {

    @RequestMapping("/")
    String hello() {
        return "Hello World! JavaInterviewPoint";
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(HelloWorld.class, args);
    }
}

We have added the below annotations in HelloWorld class

  • @RestController – This annotation is a stereotype annotation, this annotation tells spring to render the result back to the caller.
  • @RequestMapping – This annotation will any HTTP request with the path. In our application “/” should be mapped to the hello() method
  • @EnableAutoConfiguration – This annotation tells the Spring Boot to configure the application based on the dependencies added. Since spring-boot-starter-web has added Tomcat and Spring MVC, auto-configuration will setup a web based application.

Our main() method is the triggering point of our java application, it in-turn calls Spring Boot’s SpringApplication class run() method which bootstraps our HelloWorld application and starts the tomcat server. We need to pass our HelloWorld.class as an argument to our run() method.

Again run “mvn package” command after placing the java file

|-- pom.xml
|-- src
|   |-- main
|       |-- java
|           |--HelloWorld.java
|-- target
    |-- classes
    |   |-- HelloWorld.class
    |-- generated-sources
    |   |-- annotations
    |-- maven-archiver
    |   |-- pom.properties
    |-- maven-status
    |   |-- maven-compiler-plugin
    |       |-- compile
    |           |-- default-compile
    |               |-- createdFiles.lst
    |               |-- inputFiles.lst
    |-- SpringBootTutorial-0.0.1-SNAPSHOT.jar

Step 4: Execution

We will be executing our Spring Boot Hello World example in two different ways.

  1. Using spring-boot: run
  2. Creating an executable jar and running the jar

1. Running using spring-boot:run

In the command prompt from the root directory of the project start the application using the command “mvn spring-boot:run”

E:\Jackson\SpringBootTutorial>mvn spring-boot:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringBootTutorial 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.5.1.RELEASE:run (default-cli) > test-compile @ SpringBootTutorial >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ SpringBootTutorial ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\Jackson\SpringBootTutorial\src\main\resources
[INFO] skip non existing resourceDirectory E:\Jackson\SpringBootTutorial\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ SpringBootTutorial ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ SpringBootTutorial ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\Jackson\SpringBootTutorial\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ SpringBootTutorial ---
[INFO] No sources to compile
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.5.1.RELEASE:run (default-cli) < test-compile @ SpringBootTutorial <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.1.RELEASE:run (default-cli) @ SpringBootTutorial ---

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.1.RELEASE)

2017-02-19 15:48:02.057  INFO 1848 --- [           main] HelloWorld                               : Starting HelloWorld on user-PC with PID 1848 (E:\Jackson\Spr
ingBootTutorial\target\classes started by user in E:\Jackson\SpringBootTutorial)
2017-02-19 15:48:02.060  INFO 1848 --- [           main] HelloWorld                               : No active profile set, falling back to default profiles: def
ault
2017-02-19 15:48:02.095  INFO 1848 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.Annotat
[email protected]: startup date [Sun Feb 19 15:48:02 IST 2017]; root of context hierarchy
2017-02-19 15:48:02.942  INFO 1848 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.validation.Vali
dationAutoConfiguration' of type [class org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration] is not eligible for getting processed by
all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-02-19 15:48:03.026  INFO 1848 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'validator' of type [class org.springframework.validati
on.beanvalidation.LocalValidatorFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-02-19 15:48:03.416  INFO 1848 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-02-19 15:48:03.427  INFO 1848 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2017-02-19 15:48:03.428  INFO 1848 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.11
2017-02-19 15:48:03.504  INFO 1848 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-02-19 15:48:03.505  INFO 1848 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1411
 ms
2017-02-19 15:48:03.650  INFO 1848 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-02-19 15:48:03.654  INFO 1848 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-02-19 15:48:03.655  INFO 1848 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-02-19 15:48:03.655  INFO 1848 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-02-19 15:48:03.656  INFO 1848 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-02-19 15:48:04.088  INFO 1848 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.cont
[email protected]3: startup date [Sun Feb 19 15:48:02 IST 2017]; root of context hierarchy
2017-02-19 15:48:04.158  INFO 1848 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto java.lang.String HelloWorld.home()
2017-02-19 15:48:04.163  INFO 1848 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.spr
ingframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.serv
let.http.HttpServletResponse)
2017-02-19 15:48:04.164  INFO 1848 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.Res
ponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServ
letRequest)
2017-02-19 15:48:04.197  INFO 1848 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class or
g.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-19 15:48:04.198  INFO 1848 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.spring
framework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-19 15:48:04.242  INFO 1848 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [clas
s org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-19 15:48:04.404  INFO 1848 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-02-19 15:48:04.466  INFO 1848 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-02-19 15:48:04.472  INFO 1848 --- [           main] HelloWorld                               : Started HelloWorld in 2.776 seconds (JVM running for 5.822)
2017-02-19 15:48:11.749  INFO 1848 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-02-19 15:48:11.749  INFO 1848 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started

2017-02-19 15:48:11.766  INFO 1848 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization complet
ed in 16 ms

Output :

Now you will have everything started, hit on the URL “http://localhost:8080”

Spring Boot Hello World Example

 

 

 

2. Creating an executable jar and running the jar

Let’s create an executable jar file, in order to create an executable jar we need to add the spring-boot-maven-plugin to our pom.xml. Now our modified pom file looks like below

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0	http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>

   <groupId>com.javainterviewpoint</groupId>
   <artifactId>SpringBootTutorial</artifactId>
   <version>0.0.1-SNAPSHOT</version>

   <parent>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-parent</artifactId>
     <version>1.5.1.RELEASE</version>
   </parent>
   
   <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
   </dependencies>
   <build>
     <plugins>
       <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
       </plugin>
     </plugins>
   </build>
 </project>

Now run the package command again (mvn package)

|-- pom.xml
|-- src
|   |-- main
|       |-- java
|           |--HelloWorld.java
|-- target
    |-- classes
    |   |-- HelloWorld.class
    |-- generated-sources
    |   |-- annotations
    |-- maven-archiver
    |   |-- pom.properties
    |-- maven-status
    |   |-- maven-compiler-plugin
    |       |-- compile
    |           |-- default-compile
    |               |-- createdFiles.lst
    |               |-- inputFiles.lst
    |-- SpringBootTutorial-0.0.1-SNAPSHOT.jar
    |-- SpringBootTutorial-0.0.1-SNAPSHOT.jar.original

Now you will see a .original file created along with our .jar file. In order to run the jar which we built, use “java -jar” command

C:\Jackson\SpringBootTutorial>java -jar target/SpringBootTutorial-0.0.1-SNAPSHOT.jar

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.1.RELEASE)

2017-02-21 10:28:38.799  INFO 7892 --- [           main] HelloWorld                               : Starting HelloWorld on DA56CZ8VD02 with PID 7892 (C:\Jackson\SpringBootTutorial\target\SpringBootTutorial-0.0.1-SNAPSHOT.jar started by xbbl47m in C:\Jackson\SpringBootTutorial)
2017-02-21 10:28:38.805  INFO 7892 --- [           main] HelloWorld                               : No active profile set, falling back to default profiles: default
2017-02-21 10:28:38.876  INFO 7892 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot[email protected]920d014: startup date [Tue Feb 21 10:28:38 IST 2017]; root of context hierarchy
2017-02-21 10:28:39.955  INFO 7892 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration' of type [class org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-02-21 10:28:40.118  INFO 7892 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'validator' of type [class org.springframework.validation.beanvalidation.LocalValidatorFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-02-21 10:28:40.596  INFO 7892 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-02-21 10:28:40.611  INFO 7892 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2017-02-21 10:28:40.613  INFO 7892 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.11
2017-02-21 10:28:40.727  INFO 7892 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-02-21 10:28:40.727  INFO 7892 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1853 ms
2017-02-21 10:28:40.904  INFO 7892 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-02-21 10:28:40.910  INFO 7892 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-02-21 10:28:40.911  INFO 7892 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-02-21 10:28:40.911  INFO 7892 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-02-21 10:28:40.911  INFO 7892 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-02-21 10:28:41.260  INFO 7892 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot[email protected]920d014: startup date [Tue Feb 21 10:28:38 IST 2017]; root of context hierarchy
2017-02-21 10:28:41.379  INFO 7892 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto java.lang.String HelloWorld.hello()
2017-02-21 10:28:41.384  INFO 7892 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-02-21 10:28:41.385  INFO 7892 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-02-21 10:28:41.425  INFO 7892 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-21 10:28:41.425  INFO 7892 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-21 10:28:41.482  INFO 7892 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-21 10:28:41.740  INFO 7892 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-02-21 10:28:41.832  INFO 7892 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-02-21 10:28:41.840  INFO 7892 --- [           main] HelloWorld                               : Started HelloWorld in 3.658 seconds (JVM running for 4.228)
2017-02-21 10:28:58.337  INFO 7892 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-02-21 10:28:58.337  INFO 7892 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2017-02-21 10:28:58.358  INFO 7892 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 21 ms

hit on the URL “http://localhost:8080” you will get the same output.

Filed Under: J2EE, Java, Spring Boot Tagged With: Spring Boot Hello World

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Java Basics

  • JVM Architecture
  • Object in Java
  • Class in Java
  • How to Set Classpath for Java in Windows
  • Components of JDK
  • Decompiling a class file
  • Use of Class.forName in java
  • Use Class.forName in SQL JDBC

Oops Concepts

  • Inheritance in Java
  • Types of Inheritance in Java
  • Single Inheritance in Java
  • Multiple Inheritance in Java
  • Multilevel Inheritance in Java
  • Hierarchical Inheritance in Java
  • Hybrid Inheritance in Java
  • Polymorphism in Java – Method Overloading and Overriding
  • Types of Polymorphism in java
  • Method Overriding in Java
  • Can we Overload static methods in Java
  • Can we Override static methods in Java
  • Java Constructor Overloading
  • Java Method Overloading Example
  • Encapsulation in Java with Example
  • Constructor in Java
  • Constructor in an Interface?
  • Parameterized Constructor in Java
  • Constructor Chaining with example
  • What is the use of a Private Constructors in Java
  • Interface in Java
  • What is Marker Interface
  • Abstract Class in Java

Java Keywords

  • Java this keyword
  • Java super keyword
  • Final Keyword in Java
  • static Keyword in Java
  • Static Import
  • Transient Keyword

Miscellaneous

  • newInstance() method
  • How does Hashmap works internally in Java
  • Java Ternary operator
  • How System.out.println() really work?
  • Autoboxing and Unboxing Examples
  • Serialization and Deserialization in Java with Example
  • Generate SerialVersionUID in Java
  • How to make a class Immutable in Java
  • Differences betwen HashMap and Hashtable
  • Difference between Enumeration and Iterator ?
  • Difference between fail-fast and fail-safe Iterator
  • Difference Between Interface and Abstract Class in Java
  • Difference between equals() and ==
  • Sort Objects in a ArrayList using Java Comparable Interface
  • Sort Objects in a ArrayList using Java Comparator

Follow

  • Coding Utils

Useful Links

  • Spring 4.1.x Documentation
  • Spring 3.2.x Documentation
  • Spring 2.5.x Documentation
  • Java 6 API
  • Java 7 API
  • Java 8 API
  • Java EE 5 Tutorial
  • Java EE 6 Tutorial
  • Java EE 7 Tutorial
  • Maven Repository
  • Hibernate ORM

About JavaInterviewPoint

javainterviewpoint.com is a tech blog dedicated to all Java/J2EE developers and Web Developers. We publish useful tutorials on Java, J2EE and all latest frameworks.

All examples and tutorials posted here are very well tested in our development environment.

Connect with us on Facebook | Privacy Policy | Sitemap

Copyright ©2023 · Java Interview Point - All Rights Are Reserved ·