Spring Boot
| Spring Boot | |
|---|---|
| File:Spring Boot.svg | |
| Original author | Rod Johnson |
| Developer | VMware |
| Initial release | April 2014[1] |
| Repository |
|
| Written in | Java |
| Engine | |
| Platform | Java EE |
| Type | Application framework |
| License | Apache License 2.0 |
Lua error in mw.title.lua at line 392: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal'). Spring Boot is an open-source Java framework used for programming standalone, production-grade Spring-based applications with a bundle of libraries that make project startup and management easier.[2] Spring Boot is a convention-over-configuration extension for the Spring Java platform intended to help minimize configuration concerns while creating Spring-based applications.[3][4] The application can still be adjusted for specific needs, but the initial Spring Boot project provides a preconfigured "opinionated view" of the best configuration to use with the Spring platform and selected third-party libraries.[5][6]
Spring Boot can be used to build microservices, web applications, and console applications.[2][7]
Features
[edit | edit source]- Embedded Tomcat, Jetty or Undertow web application server.[8]
- Provides opinionated 'starter' Project Object Models (POMs) for the build tool. The only build tools supported are Maven and Gradle.[9][10]
- Automatic configuration of the Spring Application.[11]
- Provides production-ready[3] functionality such as metrics,[12] health checks,[12] and externalized configuration.[13]
- No code generation is required.[8]
- No XML configuration is required.[9]
- Optional support for Kotlin and Apache Groovy in addition to Java.[2][14]
Bootstrapping DispatcherServlet
[edit | edit source]Spring Boot does not require manual configuration of the DispatcherServlet, since it automatically configures the application based on the configuration it detects. [15]
SpringBootServletInitializer
[edit | edit source]Spring Boot has a class SpringBootServletInitializer, which is a specialization of the WebApplicationInitializer.[15] This SpringBootServletInitializer is an out-of-the-box implementation of WebApplicationInitializer, which eliminates the need for the developer to construct their own implementation of the WebApplicationInitializer class.[15]
Configuration properties
[edit | edit source]The configuration properties for the Spring Boot application can be specified in the application.properties or application.yml file.[15]
Examples of properties that can be included in this file include the server.port and spring.application.name properties.[15]
Autoconfiguration
[edit | edit source]@SpringBootApplication
[edit | edit source]Spring Boot has an annotation, @SpringBootApplication, which allows the Spring Boot application to autoconfigure third-party libraries and detected features found on the classpath.[15] As an example, the class that has the @SpringBootApplication annotation can extend the SpringBootServerInitializer class if the application is packaged and deployed as a WAR file.[15]
The @SpringBootApplication annotation combines three Spring-specific annotations: @SpringBootConfiguration, @EnableAutoConfiguration and @ComponentScan.[16]
@SpringBootConfiguration
[edit | edit source]The @SpringBootConfiguration annotation is a specialization of the Spring-specific @Configuration annotation.[16] The class with the @SpringBootConfiguration is marked as the configuration class for the Spring Boot application.[16]
@EnableAutoConfiguration
[edit | edit source]The @EnableAutoConfiguration annotation is Spring-specific annotation that enables the Spring Boot automatic configuration. [16]
Actuator
[edit | edit source]The Spring Boot Actuator allows for monitoring and management capabilities for the Spring Boot Application.[17] A major advantage of using the Spring Boot Actuator is that it implements a number of production-ready features without requiring the developer to construct their own implementations.[17]
If Maven is used as the build tool, then the spring-boot-starter-actuator dependency can be specified in the pom.xml configuration file.[18]
Integration with Spring Framework Modules
[edit | edit source]Spring Boot has a number of existing Spring Framework Modules.
Spring Security
[edit | edit source]Spring Boot has integration with the Spring Security Module. The simplest way for integrating Spring Boot with Spring Security is to declare the starter dependency in the build configuration file.[19]
If Maven is used as the build tool, then the dependency with artifact ID spring-boot-starter-security dependency can be specified in the pom.xml configuration file.[19]
Application servers
[edit | edit source]By default, Spring boot provides embedded web servers (such as Tomcat) out-of-the-box.[20] However, Spring Boot can also be deployed as a WAR file on a standalone WildFly application server.[21]
If Maven is used as the build tool, there is a wildfly-maven-plugin Maven plugin that allows for automatic deployment of the generated WAR file.[21]
References
[edit | edit source]- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ a b c Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ a b Walls 2016, p. vii, §foreword.
- ^ Walls 2016, pp. 37–48, §2.3.
- ^ Walls 2016, p. 48, §2.4.
- ^ Deinum & Cosmina 2021, pp. 21–22, §2 Spring Framework Fundamentals.
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ a b Walls 2016, p. 7, §1.1.3.
- ^ a b Walls 2016, p. x, §Preface.
- ^ Musib 2022, p. 9, §1.2.1 Maven vs Gradle.
- ^ Walls 2016, pp. 4–5, §1.1.2.
- ^ a b Walls 2016, pp. 124–139, §7.
- ^ Walls 2016, pp. 49–69, §3.1-§3.2.3.
- ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- ^ a b c d e f g Deinum & Cosmina 2021, pp. 52–54, §2 Spring Framework Fundamentals - Spring Boot.
- ^ a b c d Walls 2019, pp. 11–17, §1.2.2 Examining the Spring project structure.
- ^ a b Musib 2022, pp. 144–145, §4.4 Spring Boot Actuator.
- ^ Musib 2022, pp. 145–146, §4.4.1 Configuring Spring Boot Actuator in a Spring Boot application.
- ^ a b Musib 2022, pp. 187–192, §5.2.1 Configuring Spring Boot Actuator in a Spring Boot application.
- ^ Musib 2022, pp. 7–8, §1.1.4 Spring Boot components.
- ^ a b Musib 2022, pp. 406–417, §9.2 Deploying Spring Boot application as WAR in the wildfly application server.
- Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
- Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
External links
[edit | edit source]Lua error in Module:Authority_control at line 153: attempt to index field 'wikibase' (a nil value).