Getting started with Spring Boot, | Part-01
-
Standalone: A Spring Boot application is 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). An example of this would be an application that has
spring-boot-starter-web
as a dependency, which when run will by default inside an embedded Tomcat web container. - Production-grade: A Spring Boot application enables most of the features required for production, such as monitoring, connection pools, externalized configurations, and so on, out of the box, and ships with industry-standard, time-tested, and proven third-party applications such as Tomcat.
-
Flexible: A Spring Boot application will have most of its settings auto-configured with default settings based on the dependencies available in the classpath of the application. But the auto-configuration will step back whenever a custom configuration is made. An example for this would be when a Spring Boot application finds a MySQL JDBC driver in the classpath; it auto-configures DataSource, which connects to the host localhost and port
3306
, as those will be the settings for a MySQL Server with a default installation. -
Extensible: A Spring Boot application will have most core functionalities implemented out of the box, but also has a lot of Service Provider Interfaces (SPI), which are used by third-party developers to implement or modify functionality. An example of this would be when a requirement arises for a custom endpoint in Spring Boot Actuator; extending and overriding the
AbstractEndpoint.invoke
method in a Spring Bean will expose it as a new endpoint under Spring Boot Actuator.
Anatomy of a Spring Boot application
The anatomy of a Spring Boot application will be that it will be inheriting from a spring-boot-starter-parent
project that will in return have all the common dependencies available for a Spring Boot application. Apart from this, there will be one or more spring-boot-starter
POM such as spring-boot-starter-web
, spring-boot-starter-jpa
, and so on. The following example excerpt from pom.xml
shows the basic dependencies of a Spring Boot application: