MTI TEK
Spring Framework
|
Spring Boot Tooling
Spring Boot Overview
- Starter dependencies: curated dependency descriptors — they contain no library code themselves but pull in a set of compatible transitive dependencies for a given Spring Boot version.
- Autoconfiguration: Spring Boot guesses and configures components automatically based on classpath entries, environment variables, and other factors.
- Actuator: provides runtime insight into the application — metrics, thread dumps, health status, and environment properties.
- Flexible environment properties: supports configuration via
application.properties, application.yml, environment variables, and command-line arguments.
- Spring Boot CLI: allows writing a Spring application as a collection of Groovy scripts and running it from the command line.
Starter Dependencies
- Named with the pattern
spring-boot-starter-[dependency] — e.g. spring-boot-starter-web, spring-boot-starter-data-jpa.
- Starter dependencies contain no library code — they are pure dependency aggregators that pull in a set of libraries known to work together for a given Spring Boot version.
- Individual library versions do not need to be managed explicitly — the parent POM (
spring-boot-starter-parent) manages all compatible versions.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Spring Boot Maven Plugin
- Declared as
spring-boot-maven-plugin in the <build> section of pom.xml.
- Enables running the application directly via Maven:
mvn spring-boot:run.
- Packages the application as an executable fat JAR — all dependency libraries are bundled inside and available on the runtime classpath.
- Adds a manifest file to the JAR that designates the bootstrap class as the entry point.
DevTools
- Added via the
spring-boot-devtools dependency — it is not an IDE plugin.
- Automatically disabled in production environments.
- Enables automatic application restart when source files change.
How Automatic Restart Works
- DevTools loads the application into two separate classloaders in the JVM:
- One classloader for application code (
src/main).
- One classloader for dependency libraries.
- When application code changes, only the application classloader is reloaded and the Spring application context is restarted — the dependency classloader is reused, making the restart fast.
- If a dependency library itself changes, a full restart of the JVM is required.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- prevents transitively pulling devtools into downstream projects -->
</dependency>
Spring Initializr
- Generates a skeleton Spring Boot project structure with the selected dependencies, build tool, Java version, and packaging.
- Available at
https://start.spring.io/ — both a browser-based UI and a REST API.
- Accessible via: web browser, Spring Tool Suite, Spring Boot CLI, or
curl.
Spring Tool Suite (STS)
- Spring-specific IDE extensions available for Eclipse, VS Code, and IntelliJ — download at
https://spring.io/tools.
- Spring Boot Dashboard: central hub to manage, run, and debug Spring Boot applications from within the IDE.
- Smart code completion: context-aware suggestions for Spring-specific elements — bean names, configuration property keys, etc.
- Live metadata integration: surfaces live Actuator data directly in the editor while the application is running.
- Spring Initializr wizard: built-in project generation — Eclipse: File → New → Spring Starter Project.