Skip to content

Commit c63e948

Browse files
Fix ssl enabled property in Redis config for Spring Boot 3.1 (#254)
* Fix ssl enabled property In Srping Boot 3.1, the flag is ssl.enbled not ssl, as in the java doc here: https://docs.spring.io/spring-boot/docs/3.1.8/api/org/springframework/boot/autoconfigure/data/redis/RedisProperties.Ssl.html#isEnabled() * Using Boolean instead of String * Redis SSL properties change: Add test --------- Co-authored-by: Anthony Dahanne <[email protected]>
1 parent 7673f2f commit c63e948

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

java-cfenv-boot/src/main/java/io/pivotal/cfenv/spring/boot/RedisCfEnvProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void process(CfCredentials cfCredentials, Map<String, Object> properties)
5858
Optional<String> tlsPort = Optional.ofNullable(cfCredentials.getString("tls_port"));
5959
if (tlsPort.isPresent()) {
6060
properties.put(PREFIX + ".port", tlsPort.get());
61-
properties.put(PREFIX + ".ssl", "true");
61+
properties.put(PREFIX + ".ssl.enabled", Boolean.TRUE);
6262
} else {
6363
properties.put(PREFIX + ".port", cfCredentials.getPort());
6464
}
@@ -68,7 +68,7 @@ public void process(CfCredentials cfCredentials, Map<String, Object> properties)
6868
properties.put(PREFIX + ".port", uriInfo.getPort());
6969
properties.put(PREFIX + ".password", uriInfo.getPassword());
7070
if (uriInfo.getScheme().equals("rediss")) {
71-
properties.put(PREFIX + ".ssl", "true");
71+
properties.put(PREFIX + ".ssl.enabled", Boolean.TRUE);
7272
}
7373
}
7474
}

java-cfenv-boot/src/test/java/io/pivotal/cfenv/spring/boot/RedisCfEnvProcessorTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void testRedisBootPropertiesWithTLSEnabledInCredentials() {
5757
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".host")).isEqualTo(hostname);
5858
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".port")).isEqualTo(String.valueOf(TLS_PORT));
5959
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".password")).isEqualTo(password);
60-
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".ssl")).isEqualTo("true");
60+
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".ssl.enabled")).isEqualTo("true");
6161
}
6262

6363
@Test
@@ -67,7 +67,7 @@ public void testRedisSSlBootPropertiesWithUriInCredentials() {
6767

6868
Environment environment = getEnvironment();
6969
commonAssertions(getEnvironment(), SPRING_DATA_REDIS);
70-
assertThat(environment.getProperty(SPRING_DATA_REDIS+".ssl")).isEqualTo("true");
70+
assertThat(environment.getProperty(SPRING_DATA_REDIS+".ssl.enabled")).isEqualTo("true");
7171
}
7272

7373
@Test

0 commit comments

Comments
 (0)