Activate by default in Spring Boot 3

* Users used to provide this property to enable this library: -Dorg.springframework.cloud.bindings.boot.enable=true ; with this new major version (2), we default to enable true
This commit is contained in:
Anthony Dahanne
2023-06-14 11:16:55 -04:00
parent 3b43462fc4
commit 7e452047bf
4 changed files with 4 additions and 5 deletions

View File

@@ -13,4 +13,4 @@ In a Spring Boot 3 application, the mapping needs to be different because of cha
This module runs an application, based on Spring Boot 3, and checks whether the `RedisConnectionFactory` properly picked up the `spring.data.redis.port` and `spring.data.redis.host` values.
Pay attention to the 2 environment variables set in the `pom.xml` that set the `JAVA_TOOL_OPTIONS` and `SERVICE_BINDING_ROOT` - they allow Spring Boot Bindings to load the proper configuration in `bindings/redis`
Pay attention to the 2 environment variables set in the `pom.xml` that set `SERVICE_BINDING_ROOT` - they allow Spring Boot Bindings to load the proper configuration in `bindings/redis`

View File

@@ -64,7 +64,6 @@
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<environmentVariables>
<JAVA_TOOL_OPTIONS>-Dorg.springframework.cloud.bindings.boot.enable=true</JAVA_TOOL_OPTIONS>
<SERVICE_BINDING_ROOT>${basedir}/src/test/resources/bindings</SERVICE_BINDING_ROOT>
</environmentVariables>
<argLine>-Xmx1024m</argLine>

View File

@@ -21,7 +21,7 @@ import org.springframework.core.env.Environment;
final class Guards {
static boolean isGlobalEnabled(Environment environment) {
return environment.getProperty("org.springframework.cloud.bindings.boot.enable", Boolean.class, false);
return environment.getProperty("org.springframework.cloud.bindings.boot.enable", Boolean.class, true);
}
static boolean isTypeEnabled(Environment environment, String type) {

View File

@@ -35,9 +35,9 @@ final class GuardsTest {
private final MockEnvironment environment = new MockEnvironment();
@Test
@DisplayName("returns false if unset")
@DisplayName("returns true if unset")
void unset() {
assertThat(isGlobalEnabled(environment)).isFalse();
assertThat(isGlobalEnabled(environment)).isTrue();
}
@Test