From 8a9c1a1911594488d7e0e8f8a6384f260a1e036b Mon Sep 17 00:00:00 2001 From: Gerardo Roza Date: Wed, 16 Dec 2020 16:38:31 -0300 Subject: [PATCH 1/2] migrated spring.profiles properties to spring.config.activate.on-profile --- .../src/main/resources/application.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spring-boot-modules/spring-boot-properties/src/main/resources/application.yml b/spring-boot-modules/spring-boot-properties/src/main/resources/application.yml index fc9bb42a95..61d462bb5a 100644 --- a/spring-boot-modules/spring-boot-properties/src/main/resources/application.yml +++ b/spring-boot-modules/spring-boot-properties/src/main/resources/application.yml @@ -6,7 +6,9 @@ spring: --- spring: - profiles: test + config: + activate: + on-profile: test name: test-YAML environment: testing enabled: false @@ -37,7 +39,9 @@ component: --- spring: - profiles: prod + config: + activate: + on-profile: prod name: prod-YAML environment: production enabled: true @@ -48,7 +52,9 @@ servers: --- spring: - profiles: dev + config: + activate: + on-profile: dev name: ${DEV_NAME:dev-YAML} environment: development enabled: true From 7b17a09eb74b9401b7d28a85d0ea2bfd660ccdfe Mon Sep 17 00:00:00 2001 From: Gerardo Roza Date: Wed, 16 Dec 2020 16:53:33 -0300 Subject: [PATCH 2/2] avoid using deprecated StringUtils#isEmpty method --- .../properties/reloading/configs/ReloadablePropertySource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySource.java b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySource.java index 6d76a2e1e2..5d4e170226 100644 --- a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySource.java +++ b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySource.java @@ -15,7 +15,7 @@ public class ReloadablePropertySource extends PropertySource { } public ReloadablePropertySource(String name, String path) { - super(StringUtils.isEmpty(name) ? path : name); + super(StringUtils.hasText(name) ? path : name); try { this.propertiesConfiguration = new PropertiesConfiguration(path); FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();