How to Develop Spring Boot Application

Want to develop Java Spring based application quickly and without worrying about maven dependencies? Then you need to try Spring Boot. It offers a fast way to build java applications.

Advantages of Spring Boot

  1. Spring Boot adds them automatically spring bean which requires to develop Spring-MVC Application.
  2. Spring MVC app also needs a servlet container, so Spring Boot automatically configures embedded Tomcat.It has Embed Tomcat, Jetty or Undertow directly.
  3. Spring bott has @SpringBootApplication is a convenience annotation that adds all of the following:

    • @Configuration tags the class as a source of bean definitions for the application context.
    • @EnableAutoConfiguration tells Spring Boot to start adding beans based on classpath settings, other beans, and various property settings.
    • Normally you would add @EnableWebMvc for a Spring MVC app, but Spring Boot adds it automatically when it sees spring-webmvc on the classpath. This flags the application as a web application and activates key behaviors such as setting up a DispatcherServlet.
    • @ComponentScan tells Spring to look for other components, configurations, and services in the the hello package, allowing it to find the controllers.

    4. You don’t want to define DataSource, EntityManagerFactory, TransactionManageretc beans but they are automatically gets created.

    Absolutely no code generation and no requirement for XML configuration                                                                                                                 5. Provide production-ready features such as metrics, health checks and externalised configuration.

  Spring Boot POM.xml will looks like this 

You can configure datasource/JPA Properties in as Follows

Sample Application

The @SpringBootApplication annotation is equivalent to using @Configuration, @EnableAutoConfiguration and @ComponentScan with their default attributes:


How to disable Embedded Tomcat in Spring Boot

You can use below code to disable the embedded tomcat in spring boot.

I hope you got some good idea about Spring Boot Applications. Please let me know if you need any info on this.


About mohan

This is Mohan Jayapalan author of TechPages Blog.I am a part time blogger and Currently working for private Software Concern.

© Copyright 2010-2016 · All Rights Reserved · Powered by WordPress ·