What Spring Boot adds
Spring Concepts / Detailed guide
Spring Boot builds on Spring Framework and simplifies application setup. It provides automatic configuration, starter dependencies, and tools for packaging your application as an executable JAR. For web applications, it can also configure an embedded server.
Automatic configuration examines the libraries included in your project, your application settings, and the Spring beans you have already configured. It uses this information to decide which components to set up.
For example:
- Adding the Spring MVC starter allows Spring Boot to configure components for handling web requests.
- Adding the Thymeleaf starter allows it to configure a template engine that generates HTML pages.
- Adding the MongoDB starter and providing a valid connection URI allows it to configure the components your application needs to access MongoDB.
A library is “present” when it is included in your project and available to the application when it runs. For example, adding a starter dependency to pom.xml lets Maven download the required library JARs and include them in the application. The classpath is where Java looks for application classes and libraries. “Thymeleaf is present on the classpath” means Java can find the Thymeleaf library.
For MongoDB, this refers to the Java libraries used to connect to the database. The database itself runs on a server or Atlas cluster, and the connection URI tells your application how to reach it. Spring Boot also considers configuration conditions and existing beans; adding a library does not guarantee that every possible component will be configured.
A starter is a convenient dependency group. The parent POM manages compatible versions, so individual starter versions are omitted. The Maven plugin packages dependencies into an executable JAR. You can run it with java -jar rather than deploying a WAR manually.
@SpringBootApplication combines @Configuration, @EnableAutoConfiguration, and @ComponentScan. Put it above your application packages. It is not a substitute for understanding beans; it is the entry point that connects their discovery and configuration.
Boot is also useful for applications without web pages. A REST application still uses Spring MVC and Tomcat, but JSON serialization replaces template resolution. Spring Boot and Spring MVC are related parts of the stack, not two competing frameworks.