Spring Boot is an open-source Java-based framework that creates a micro Service. An architecture that allows the developers to develop and deploy services independently is known as Micro Service. To achieve the lightweight model to support business applications, each service running has its own process. Spring boot helps in building stand-alone and production-ready spring applications because it needs minimal Spring configuration.
- It provides an easier and faster way to set up, configure, and run both simple and web-based applications.
- The RAD (Rapid Application Development) feature is provided to the Spring Framework by a Spring module known as Spring Boot.
- It is the combination of Spring Framework and Embedded Servers.
- Spring boot doesn’t require any XML configuration (deployment descriptor). It uses convention over configuration software design paradigm that means it decreases the effort of the developer.
- We can use Spring STS IDE or Spring Initializer to develop Spring Boot Java applications. In this tutorial, we will discuss using Spring Initializer.
Prerequisite
- Java 1.8
- Maven 3.0+
- Spring Framework 5.0.0.BUILD-SNAPSHOT
Features
- Starter Project
- It provides a quick starter project (start.spring.io) with auto-configuration(web, JPA, dev tools, etc).
- Web Development
- We can easily create a self-contained HTTP application that uses embedded servers like Tomcat, Jetty, or Undertow.
- We can use the spring-boot-starter-web module to start and run the application quickly.
- SpringApplication
- The SpringApplication is a class that provides a convenient way to bootstrap a Spring application.
- Application events and listeners
- It allows us to create factories file in the META-INF folder like META-INF/spring.factories that is useful for adding listeners.
- Admin features
- It accesses & manages applications remotely by using spring.application.admin.enabled property.
- Externalized Configuration
- It allows us to work with the same application in different environments
- YAML Support
- It is a superset of JSON that externalizes configuration.
- Type-safe Configuration
- It governs and validates the configuration of the application.
- Actuator
- Spring boot Actuator helps us monitor and manage application when pushed to production.
How to create a Spring boot project?
Visit the Spring Initializer web page and choose your Build, Spring Boot Version, platform, provide a Group, Artifact, and required dependencies, as shown below –
Topic | Definition |
---|---|
Project | It defines the kind of project i.e. Maven Project or Gradle Project. |
Language | It provides the choice among three languages Java, Kotlin, and Groovy. Java is by default selected. |
Spring Boot | We can select the Spring Boot version. The latest version is 2.2.2. |
Group | It denotes the package name. The default Group name is com.example |
Artifact | It denotes the Application name. The default Artifact name is a demo. |
Name | It is the same as Artifact. |
Description | In the description field, we can write a description of the project. |
Package Name | It is also similar to the Group name. |
Packaging | We can select the packing of the project i.e. Jar or War. |
Java | We can select the JVM version which we want to use. |
Dependencies | Dependencies are the collection of artifacts that we can add to our project. |
Click on the Generate Project button, a zip file will download. After you download the project, unzip the file.Â