Spring Boot¶
Spring Boot is a framework that simplifies the creation of stand-alone, Spring based applications.
To enable Spring Boot support, add the following to the module.yaml file:
settings:
springBoot: enabled
Setting springBoot: enabled performs the following actions:
- Applies the Spring Boot Dependencies BOM
- Adds the
spring-boot-starterdependency - Adds the
spring-boot-starter-testtest dependency - Configures
all-openandno-argKotlin compiler plugins with thespringpreset - Adds the necessary compiler arguments for
kotlincandjavac: - For Java,
-parametersis passed to the compiler to preserve parameter names. - For Kotlin,
-java-parametersis passed to the compiler for the same reason. Also-Xjsr305is set tostrictto favor the null-safety annotations. - Contributes Spring Boot-related entries to the built-in library catalog
- Makes
amper runrun with classes instead of JARs (aka thejvm.runtimeClasspathModesetting).
This way the Spring Dev Tools can provide automatic restarts.
Mixed projects (containing Java and Kotlin sources simultaneously) are supported.
Examples of Spring Boot projects:
You can also customize the version of the Spring Boot libraries using the full form of the configuration:
settings:
springBoot:
enabled: true
version: 3.5.7
If you don't want the Spring Boot Dependencies BOM to be applied, you can disable it explicitly:
settings:
springBoot:
enabled: true
applyBom: false