Chapter 2. Configuring your application to use Spring Boot
Reference the Spring Boot BOM (Bill of Materials) artifact in the pom.xml
file at the root directory of your application.
Prerequisites
- A Maven-based application
Procedure
Open the
pom.xml
file, add theme.snowdrop:spring-boot-bom
artifact to the<dependencyManagement>
section, and specify the<type>pom</type>
and<scope>import</scope>
:<project> ... <dependencyManagement> <dependencies> <dependency> <groupId>me.snowdrop</groupId> <artifactId>spring-boot-bom</artifactId> <version>2.1.15.Final-redhat-00001</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> ... </project>
Include the following properties to track the version of Spring Boot and the Spring Boot Maven Plugin you are using:
<project> ... <properties> <spring-boot.version>2.1.15.RELEASE</spring-boot.version> <spring-boot-maven-plugin.version>2.1.15.RELEASE</spring-boot-maven-plugin.version> </properties> ... </project>
Specify the repositories containing Spring Boot Starters and the Spring Boot Maven Plugin:
<!-- Specify the repositories containing Spring Boot artifacts. --> <repositories> <repository> <id>redhat-ga</id> <name>Red Hat GA Repository</name> <url>https://maven.repository.redhat.com/ga/</url> </repository> </repositories> <!-- Specify the repositories containing the plugins used to execute the build of your application. --> <pluginRepositories> <pluginRepository> <id>redhat-ga</id> <name>Red Hat GA Repository</name> <url>https://maven.repository.redhat.com/ga/</url> </pluginRepository> </pluginRepositories>
Reference
spring-boot-maven-plugin
as the plugin used to package your application:<project> ... <build> <plugins> ... <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${spring-boot-maven-plugin.version}</version> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> <configuration> <redeploy>true</redeploy> </configuration> </plugin> ... </plugins> </build> ... </project>
Additional resources
- For more information about packaging your Spring Boot application, see the Spring Boot Maven Plugin documentation.