From c35a8606a52931a58bd62b197501840cf5687607 Mon Sep 17 00:00:00 2001 From: Stefan van den Akker Date: Wed, 13 Mar 2024 15:22:22 +0100 Subject: [PATCH] chore: upgrade to Spring Boot 3 Spring Boot 3 made some changes to the way a library, such as this one, notifies Spring Boot that it wants to be autoconfigured. [Details of this change are in the release notes of version 2.7][1]. With this commit, a new versioning system for this package is proposed: `-`. For example, `3-1.0.2`. Why? The problem with only semantic versioning _and_ following Spring releases (especially those with breaking changes) is, that it becomes unclear when to update to a new major version. Should we do it when this library introduces a breaking change? Or when Spring Boot does? To solve this, the version now consists of a leading digit, indicating the Spring Boot version that this version works with, followed by a semantic version of the library itself. So, we now have `2-1.0.2`, working with Spring Boot 2, alongside `3-1.0.2`, which works with Spring Boot 3. When a breaking change is made to this library, we would signal that by bumping the versions to `2-2.0.0` and `3-2.0.0`, respectively. [1]: --- pom.xml | 10 +++++----- .../com/bol/config/CryptVaultAutoConfiguration.java | 4 ++-- src/main/resources/META-INF/spring.factories | 1 - ...mework.boot.autoconfigure.AutoConfiguration.imports | 1 + 4 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 src/main/resources/META-INF/spring.factories create mode 100644 src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/pom.xml b/pom.xml index 907b026..cadca7c 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ cryptvault jar cryptvault - 1.0.2 + 3-1.0.2 Versioned crypto library https://github.com/bolcom/cryptvault @@ -43,26 +43,26 @@ org.springframework.boot spring-boot-autoconfigure - 2.4.0 + 3.2.3 provided org.springframework.boot spring-boot-starter-test - 2.4.0 + 3.2.3 test junit junit - 4.13.1 + 4.13.2 test org.assertj assertj-core - 3.18.1 + 3.25.3 test diff --git a/src/main/java/com/bol/config/CryptVaultAutoConfiguration.java b/src/main/java/com/bol/config/CryptVaultAutoConfiguration.java index 61e8c88..2bf3b72 100644 --- a/src/main/java/com/bol/config/CryptVaultAutoConfiguration.java +++ b/src/main/java/com/bol/config/CryptVaultAutoConfiguration.java @@ -1,16 +1,16 @@ package com.bol.config; import com.bol.crypt.CryptVault; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; import java.util.Base64; import java.util.List; -@Configuration +@AutoConfiguration @ConditionalOnProperty("cryptvault.keys[0].key") public class CryptVaultAutoConfiguration { diff --git a/src/main/resources/META-INF/spring.factories b/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 1912c2b..0000000 --- a/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.bol.config.CryptVaultAutoConfiguration diff --git a/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..0f355bd --- /dev/null +++ b/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.bol.config.CryptVaultAutoConfiguration \ No newline at end of file