From 627fb4f1d114c81ceae4bbbbc04860ef026af182 Mon Sep 17 00:00:00 2001 From: maryarm <45322329+maryarm@users.noreply.github.com> Date: Tue, 30 Jul 2019 09:49:08 +0430 Subject: [PATCH] #BAEL-2888: Reloading Properties Files in Spring (#7427) -change package name to "com.baeldung.properties.reloading" -remove module 's ".gitignore" --- spring-boot-properties/.gitignore | 17 ----------------- .../SpringBootPropertiesApplication.java | 4 ++-- .../configs/PropertiesException.java | 2 +- .../configs/ReloadableProperties.java | 2 +- .../configs/ReloadablePropertySource.java | 2 +- .../configs/ReloadablePropertySourceConfig.java | 2 +- .../ReloadablePropertySourceFactory.java | 2 +- .../PropertiesReloadIntegrationTest.java | 10 +++++----- .../SpringBootPropertiesTestApplication.java | 4 ++-- ...onfigurationPropertiesRefreshConfigBean.java | 2 +- .../beans/EnvironmentConfigBean.java | 4 ++-- .../beans/PropertiesConfigBean.java | 2 +- .../beans/ValueRefreshConfigBean.java | 2 +- 13 files changed, 19 insertions(+), 36 deletions(-) delete mode 100644 spring-boot-properties/.gitignore rename spring-boot-properties/src/main/java/com/baeldung/properties/{ => reloading}/SpringBootPropertiesApplication.java (94%) rename spring-boot-properties/src/main/java/com/baeldung/properties/{ => reloading}/configs/PropertiesException.java (78%) rename spring-boot-properties/src/main/java/com/baeldung/properties/{ => reloading}/configs/ReloadableProperties.java (96%) rename spring-boot-properties/src/main/java/com/baeldung/properties/{ => reloading}/configs/ReloadablePropertySource.java (95%) rename spring-boot-properties/src/main/java/com/baeldung/properties/{ => reloading}/configs/ReloadablePropertySourceConfig.java (95%) rename spring-boot-properties/src/main/java/com/baeldung/properties/{ => reloading}/configs/ReloadablePropertySourceFactory.java (95%) rename spring-boot-properties/src/test/java/com/baeldung/properties/{ => reloading}/PropertiesReloadIntegrationTest.java (94%) rename spring-boot-properties/src/test/java/com/baeldung/properties/{ => reloading}/SpringBootPropertiesTestApplication.java (89%) rename spring-boot-properties/src/test/java/com/baeldung/properties/{ => reloading}/beans/ConfigurationPropertiesRefreshConfigBean.java (91%) rename spring-boot-properties/src/test/java/com/baeldung/properties/{ => reloading}/beans/EnvironmentConfigBean.java (85%) rename spring-boot-properties/src/test/java/com/baeldung/properties/{ => reloading}/beans/PropertiesConfigBean.java (90%) rename spring-boot-properties/src/test/java/com/baeldung/properties/{ => reloading}/beans/ValueRefreshConfigBean.java (81%) diff --git a/spring-boot-properties/.gitignore b/spring-boot-properties/.gitignore deleted file mode 100644 index 0532ef1888..0000000000 --- a/spring-boot-properties/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear - -*.ipr -*.iml -*.iws diff --git a/spring-boot-properties/src/main/java/com/baeldung/properties/SpringBootPropertiesApplication.java b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/SpringBootPropertiesApplication.java similarity index 94% rename from spring-boot-properties/src/main/java/com/baeldung/properties/SpringBootPropertiesApplication.java rename to spring-boot-properties/src/main/java/com/baeldung/properties/reloading/SpringBootPropertiesApplication.java index 67bbddf9f1..6f76379a99 100644 --- a/spring-boot-properties/src/main/java/com/baeldung/properties/SpringBootPropertiesApplication.java +++ b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/SpringBootPropertiesApplication.java @@ -1,6 +1,6 @@ -package com.baeldung.properties; +package com.baeldung.properties.reloading; -import com.baeldung.properties.configs.ReloadableProperties; +import com.baeldung.properties.reloading.configs.ReloadableProperties; import java.io.File; import java.util.Properties; import org.apache.commons.configuration.PropertiesConfiguration; diff --git a/spring-boot-properties/src/main/java/com/baeldung/properties/configs/PropertiesException.java b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/PropertiesException.java similarity index 78% rename from spring-boot-properties/src/main/java/com/baeldung/properties/configs/PropertiesException.java rename to spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/PropertiesException.java index 5ec3a042f7..09c18aef33 100644 --- a/spring-boot-properties/src/main/java/com/baeldung/properties/configs/PropertiesException.java +++ b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/PropertiesException.java @@ -1,4 +1,4 @@ -package com.baeldung.properties.configs; +package com.baeldung.properties.reloading.configs; public class PropertiesException extends RuntimeException { public PropertiesException() { diff --git a/spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadableProperties.java b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadableProperties.java similarity index 96% rename from spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadableProperties.java rename to spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadableProperties.java index 33d503b9bd..e90e68d09a 100644 --- a/spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadableProperties.java +++ b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadableProperties.java @@ -1,4 +1,4 @@ -package com.baeldung.properties.configs; +package com.baeldung.properties.reloading.configs; import java.io.FileReader; import java.io.IOException; diff --git a/spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadablePropertySource.java b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySource.java similarity index 95% rename from spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadablePropertySource.java rename to spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySource.java index 8a0cef955f..6d76a2e1e2 100644 --- a/spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadablePropertySource.java +++ b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySource.java @@ -1,4 +1,4 @@ -package com.baeldung.properties.configs; +package com.baeldung.properties.reloading.configs; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; diff --git a/spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadablePropertySourceConfig.java b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySourceConfig.java similarity index 95% rename from spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadablePropertySourceConfig.java rename to spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySourceConfig.java index 37e1a04839..dd70e3842e 100644 --- a/spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadablePropertySourceConfig.java +++ b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySourceConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.properties.configs; +package com.baeldung.properties.reloading.configs; import org.apache.commons.configuration.PropertiesConfiguration; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadablePropertySourceFactory.java b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySourceFactory.java similarity index 95% rename from spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadablePropertySourceFactory.java rename to spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySourceFactory.java index 574362b3bf..2a620b0b2d 100644 --- a/spring-boot-properties/src/main/java/com/baeldung/properties/configs/ReloadablePropertySourceFactory.java +++ b/spring-boot-properties/src/main/java/com/baeldung/properties/reloading/configs/ReloadablePropertySourceFactory.java @@ -1,4 +1,4 @@ -package com.baeldung.properties.configs; +package com.baeldung.properties.reloading.configs; import java.io.IOException; import org.springframework.core.env.PropertySource; diff --git a/spring-boot-properties/src/test/java/com/baeldung/properties/PropertiesReloadIntegrationTest.java b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/PropertiesReloadIntegrationTest.java similarity index 94% rename from spring-boot-properties/src/test/java/com/baeldung/properties/PropertiesReloadIntegrationTest.java rename to spring-boot-properties/src/test/java/com/baeldung/properties/reloading/PropertiesReloadIntegrationTest.java index a73311ded8..0c28cb085b 100644 --- a/spring-boot-properties/src/test/java/com/baeldung/properties/PropertiesReloadIntegrationTest.java +++ b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/PropertiesReloadIntegrationTest.java @@ -1,9 +1,9 @@ -package com.baeldung.properties; +package com.baeldung.properties.reloading; -import com.baeldung.properties.beans.ConfigurationPropertiesRefreshConfigBean; -import com.baeldung.properties.beans.EnvironmentConfigBean; -import com.baeldung.properties.beans.PropertiesConfigBean; -import com.baeldung.properties.beans.ValueRefreshConfigBean; +import com.baeldung.properties.reloading.beans.ConfigurationPropertiesRefreshConfigBean; +import com.baeldung.properties.reloading.beans.EnvironmentConfigBean; +import com.baeldung.properties.reloading.beans.PropertiesConfigBean; +import com.baeldung.properties.reloading.beans.ValueRefreshConfigBean; import java.io.FileOutputStream; import org.junit.After; import org.junit.Assert; diff --git a/spring-boot-properties/src/test/java/com/baeldung/properties/SpringBootPropertiesTestApplication.java b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/SpringBootPropertiesTestApplication.java similarity index 89% rename from spring-boot-properties/src/test/java/com/baeldung/properties/SpringBootPropertiesTestApplication.java rename to spring-boot-properties/src/test/java/com/baeldung/properties/reloading/SpringBootPropertiesTestApplication.java index c572a6c053..50e8ef5b62 100644 --- a/spring-boot-properties/src/test/java/com/baeldung/properties/SpringBootPropertiesTestApplication.java +++ b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/SpringBootPropertiesTestApplication.java @@ -1,6 +1,6 @@ -package com.baeldung.properties; +package com.baeldung.properties.reloading; -import com.baeldung.properties.beans.ValueRefreshConfigBean; +import com.baeldung.properties.reloading.beans.ValueRefreshConfigBean; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.context.config.annotation.RefreshScope; diff --git a/spring-boot-properties/src/test/java/com/baeldung/properties/beans/ConfigurationPropertiesRefreshConfigBean.java b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/ConfigurationPropertiesRefreshConfigBean.java similarity index 91% rename from spring-boot-properties/src/test/java/com/baeldung/properties/beans/ConfigurationPropertiesRefreshConfigBean.java rename to spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/ConfigurationPropertiesRefreshConfigBean.java index 31f168fdcc..16892b904b 100644 --- a/spring-boot-properties/src/test/java/com/baeldung/properties/beans/ConfigurationPropertiesRefreshConfigBean.java +++ b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/ConfigurationPropertiesRefreshConfigBean.java @@ -1,4 +1,4 @@ -package com.baeldung.properties.beans; +package com.baeldung.properties.reloading.beans; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.cloud.context.config.annotation.RefreshScope; diff --git a/spring-boot-properties/src/test/java/com/baeldung/properties/beans/EnvironmentConfigBean.java b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/EnvironmentConfigBean.java similarity index 85% rename from spring-boot-properties/src/test/java/com/baeldung/properties/beans/EnvironmentConfigBean.java rename to spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/EnvironmentConfigBean.java index fef12f8656..325e8c658e 100644 --- a/spring-boot-properties/src/test/java/com/baeldung/properties/beans/EnvironmentConfigBean.java +++ b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/EnvironmentConfigBean.java @@ -1,6 +1,6 @@ -package com.baeldung.properties.beans; +package com.baeldung.properties.reloading.beans; -import com.baeldung.properties.configs.ReloadablePropertySourceFactory; +import com.baeldung.properties.reloading.configs.ReloadablePropertySourceFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; diff --git a/spring-boot-properties/src/test/java/com/baeldung/properties/beans/PropertiesConfigBean.java b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/PropertiesConfigBean.java similarity index 90% rename from spring-boot-properties/src/test/java/com/baeldung/properties/beans/PropertiesConfigBean.java rename to spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/PropertiesConfigBean.java index da773b283a..8118f6156e 100644 --- a/spring-boot-properties/src/test/java/com/baeldung/properties/beans/PropertiesConfigBean.java +++ b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/PropertiesConfigBean.java @@ -1,4 +1,4 @@ -package com.baeldung.properties.beans; +package com.baeldung.properties.reloading.beans; import java.util.Properties; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-boot-properties/src/test/java/com/baeldung/properties/beans/ValueRefreshConfigBean.java b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/ValueRefreshConfigBean.java similarity index 81% rename from spring-boot-properties/src/test/java/com/baeldung/properties/beans/ValueRefreshConfigBean.java rename to spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/ValueRefreshConfigBean.java index d806938092..1018d7c9f5 100644 --- a/spring-boot-properties/src/test/java/com/baeldung/properties/beans/ValueRefreshConfigBean.java +++ b/spring-boot-properties/src/test/java/com/baeldung/properties/reloading/beans/ValueRefreshConfigBean.java @@ -1,4 +1,4 @@ -package com.baeldung.properties.beans; +package com.baeldung.properties.reloading.beans; public class ValueRefreshConfigBean { private String color;