diff --git a/app/app/pom.xml b/app/app/pom.xml index be8d8b4..372add9 100644 --- a/app/app/pom.xml +++ b/app/app/pom.xml @@ -28,6 +28,11 @@ spring-boot-starter-test test + + org.springframework.boot + spring-boot-properties-migrator + runtime + diff --git a/components/library-autoconfigure/pom.xml b/components/library-autoconfigure/pom.xml index 571a3f0..cb02dba 100644 --- a/components/library-autoconfigure/pom.xml +++ b/components/library-autoconfigure/pom.xml @@ -38,5 +38,27 @@ spring-boot-starter-test test + + org.springframework.boot + spring-boot-configuration-processor + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.springframework.boot + spring-boot-configuration-processor + + + + + + diff --git a/components/library-autoconfigure/src/main/java/com/workshop/magic/config/GreetingAutoConfiguration.java b/components/library-autoconfigure/src/main/java/com/workshop/magic/config/GreetingAutoConfiguration.java index 3ad529a..836fe47 100644 --- a/components/library-autoconfigure/src/main/java/com/workshop/magic/config/GreetingAutoConfiguration.java +++ b/components/library-autoconfigure/src/main/java/com/workshop/magic/config/GreetingAutoConfiguration.java @@ -22,7 +22,7 @@ public class GreetingAutoConfiguration { @ConditionalOnClass(StdOutGreetingService.class) @ConditionalOnProperty(name = "workshop.greeting.type", havingValue = "stdout", matchIfMissing = true) GreetingService stdOutGreetingService(GreetingProperties properties) { - return new StdOutGreetingService(properties.getText()); + return new StdOutGreetingService(properties.getPrefix()); } @Bean @@ -30,7 +30,7 @@ public class GreetingAutoConfiguration { @ConditionalOnClass(LoggerGreetingService.class) @ConditionalOnProperty(name = "workshop.greeting.type", havingValue = "logger") GreetingService slf4jGreetingService(GreetingProperties properties) { - return new LoggerGreetingService(properties.getText()); + return new LoggerGreetingService(properties.getPrefix()); } @Bean @@ -38,6 +38,6 @@ public class GreetingAutoConfiguration { @MyCustomCondition @ConditionalOnClass(BeepGreetingService.class) GreetingService beepGreetingService(GreetingProperties properties) { - return new BeepGreetingService(properties.getText()); + return new BeepGreetingService(properties.getPrefix()); } } diff --git a/components/library-autoconfigure/src/main/java/com/workshop/magic/config/GreetingProperties.java b/components/library-autoconfigure/src/main/java/com/workshop/magic/config/GreetingProperties.java index cc9dd9b..9f6a296 100644 --- a/components/library-autoconfigure/src/main/java/com/workshop/magic/config/GreetingProperties.java +++ b/components/library-autoconfigure/src/main/java/com/workshop/magic/config/GreetingProperties.java @@ -1,18 +1,21 @@ package com.workshop.magic.config; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; @ConfigurationProperties(prefix = "workshop.greeting") public class GreetingProperties { - private String text = "Hello"; private Type type = Type.STDOUT; + private String prefix = "Hello"; + @DeprecatedConfigurationProperty(replacement = "workshop.greeting.prefix") + @Deprecated public String getText() { - return this.text; + return this.prefix; } public void setText(String text) { - this.text = text; + this.prefix = text; } public Type getType() { @@ -23,6 +26,14 @@ public class GreetingProperties { this.type = type; } + public String getPrefix() { + return this.prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + public enum Type { STDOUT, LOGGER,