Mastering Spring Boot 2.0
Mastering Spring Boot 2.0 By: Dinesh Rajput Publisher: Packt Publishing Pub. Date: May 31, 2018 Print ISBN-13: 978-1-78712-756-2 Web ISBN-13: 978-1-78712-514-8 Pages in Print Edition: 390
Getting Started with Spring Boot 2.0
Introducing Spring Boot
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run."
Spring Boot provides a new strategy for application development with the Spring Framework, with minimal fuss. It enables you to focus only on the application's functionality rather than Spring metaconfiguration. Spring Boot requires either minimal or zero configuration in the Spring application.
Simplifying Spring application development using Spring Boot
The essential key components of Spring Boot
The following are essential key components of Spring Boot:
Spring Boot Starters
Automatic configuration
Spring Boot CLI
Spring Boot Actuator
Setting up a Spring Boot workspace
Java SDK v1.8 or higher
Spring Framework 5.0.0.RELEASE or above
Maven (3.2+) and Gradle 4
Tomcat 8.5, that is, a Servlet 3.0+ compatible container
Set up Spring Boot with Maven
create minimum pom.xml file:
Developing your first Spring Boot application
Use Spring Boot Initializr (web application that can create a Spring Boot project strcuture for you).
Spring Boot Initializr through a web-based interface (https://start.spring.io)
You can also use it through an IDE such as Spring Tool Suite (STS) and IntelliJ IDEA
Using the Spring Boot CLI
Using a web interface for Spring Initializr
Go web site https://start.spring.io
Implementing the REST service
Run the class "Application" with main method.
Customizing Auto-Configuration in Spring Boot Application
Using Spring Boot properties
application.properties
Getting Started with Spring CLI and Actuator
Spring Boot privodes two interface: 1. ApplicationRunner 2.CommandLineRunner
Installing the Spring Boot CLI
Using the Initializr with the Spring Boot CLI
Spring CLI build project
Spring Boot Actuator – taking Application's Insights
The Spring Boot Actuator allows you to monitor production-ready features, such as metrics and the health of the Spring application.
Enabling Spring Boot's Actuator in your application
add dependency in pom.xml
Analyzing the Actuator's endpoints
Spring Boot's Actuator offers you several web endpoints, support the following details:
Bean details
Logger details
Configuration details
Health details
Version details
Last updated