enables us to focus on the business logic of the application instead of configurations and dependency management
a very gradual learning curve
minimum viable product (MVP) that is production-ready within maybe a couple of days or hours.
mvn spring-boot:run –debug
Components
Spring Boot
Standalone: self-contained and easily deployable. It can start with its own embedded Tomcat, Jetty, Undertow web container, or as a console application from a just standard file such as Java Archive (JAR) or Web Archive (WAR).
Production ready : such as monitoring, connection pools, externalized configuration
Maven : spring-boot-starter-parent
Spring Boot Actuator
Spring Boot Actuator is a production-ready feature for monitoring and managing a Spring Boot application using HTTP endpoints or JMX
Spring Boot Actuator’s health endpoint is really helpful for checking the status of Spring Boot application and dependent systems such as databases, message queues, and so on. By default, only the /info and /health endpoints are exposed Custom metrics using Micrometer
Command-line runners are a useful functionality to execute the various types of code that only have to be run once, after startup We can also use an @Order annotation or implement an Ordered interface so as to define the exact order in which we want Spring Boot to execute them.
1 2 3 4
@Bean public StartupRunner schedulerRunner(){ returnnew StartupRunner(); }
@ApiOperation( value = "Retrieve all users ", notes = "A list of user is returned. Current pagination is not supported.", response = User.class, responseContainer = "List", produces = "application/json") @GetMapping public ResponseEntity<List<User>> findAll() { return ResponseEntity.ok(this.userService.findAll()); }
@Query("SELECT c FROM Comment c WHERE year(c.createdDate) = ?1 AND month(c.createdDate) = ?2 AND day(c.createdDate) = ?3") List<Comment> findByCreatedYearAndMonthAndDay(int year, int month, int day);
Apache Commons Logging API => provided by Spring Framework’s spring-jcl module The simplest way to do that is through the starters, which all depend on spring-boot-starter-logging. For a web application, you need only spring-boot-starter-web