This is an automated email from the ASF dual-hosted git repository. nferraro pushed a commit to branch boot2ga in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/boot2ga by this push: new a269acf CAMEL-12380: remove spring-boot 1.5.x property resolvers a269acf is described below commit a269acf6a1fe6fd3d4e414637d9cf1f6ed828b42 Author: nferraro <ni.ferr...@gmail.com> AuthorDate: Thu Mar 22 11:17:20 2018 +0100 CAMEL-12380: remove spring-boot 1.5.x property resolvers --- .../boot/security/CamelSSLAutoConfiguration.java | 12 +- .../boot/util/HierarchicalPropertiesEvaluator.java | 11 +- .../spring/boot/util/PropertySourceUtils.java | 93 -------- .../camel/spring/boot/util/RelaxedNames.java | 260 --------------------- .../spring/boot/util/RelaxedPropertyResolver.java | 162 ------------- .../HazelcastComponentAutoConfiguration.java | 8 +- .../packaging/SpringBootAutoConfigurationMojo.java | 7 +- 7 files changed, 20 insertions(+), 533 deletions(-) diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/security/CamelSSLAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/security/CamelSSLAutoConfiguration.java index d8d54ad..33bd857 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/security/CamelSSLAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/security/CamelSSLAutoConfiguration.java @@ -16,10 +16,7 @@ */ package org.apache.camel.spring.boot.security; -import java.util.Map; - import org.apache.camel.spring.boot.CamelAutoConfiguration; -import org.apache.camel.spring.boot.util.RelaxedPropertyResolver; import org.apache.camel.util.jsse.GlobalSSLContextParametersSupplier; import org.apache.camel.util.jsse.SSLContextParameters; import org.springframework.boot.autoconfigure.AutoConfigureBefore; @@ -27,12 +24,17 @@ import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.context.properties.bind.Bindable; +import org.springframework.boot.context.properties.bind.Binder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; import org.springframework.core.type.AnnotatedTypeMetadata; +import java.util.Collections; +import java.util.Map; + @Configuration @AutoConfigureBefore(CamelAutoConfiguration.class) @EnableConfigurationProperties(CamelSSLConfigurationProperties.class) @@ -48,8 +50,8 @@ public class CamelSSLAutoConfiguration { public static class Condition extends SpringBootCondition { @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata annotatedTypeMetadata) { - RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), "camel.ssl.config"); - Map<String, Object> sslProperties = resolver.getSubProperties("."); + Binder binder = Binder.get(context.getEnvironment()); + Map<String, Object> sslProperties = binder.bind("camel.ssl.config", Bindable.mapOf(String.class, Object.class)).orElse(Collections.emptyMap()); ConditionMessage.Builder message = ConditionMessage.forCondition("camel.ssl.config"); if (sslProperties.size() > 0) { return ConditionOutcome.match(message.because("enabled")); diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java index a898d55..3d5ef7e 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java @@ -16,6 +16,8 @@ */ package org.apache.camel.spring.boot.util; +import org.springframework.boot.context.properties.bind.Bindable; +import org.springframework.boot.context.properties.bind.Binder; import org.springframework.core.env.Environment; public final class HierarchicalPropertiesEvaluator { @@ -46,11 +48,8 @@ public final class HierarchicalPropertiesEvaluator { } private static boolean isEnabled(Environment environment, String prefix, boolean defaultValue) { - RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( - environment, - prefix.endsWith(".") ? prefix : prefix + "." - ); - - return resolver.getProperty("enabled", Boolean.class, defaultValue); + String property = prefix.endsWith(".") ? prefix + "enabled" : prefix + ".enabled"; + Binder binder = Binder.get(environment); + return binder.bind(property, Bindable.of(Boolean.class)).orElse(defaultValue); } } diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/PropertySourceUtils.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/PropertySourceUtils.java deleted file mode 100644 index 073c7f9..0000000 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/PropertySourceUtils.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.spring.boot.util; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.springframework.core.env.EnumerablePropertySource; -import org.springframework.core.env.PropertySource; -import org.springframework.core.env.PropertySources; - -/** - * Convenience class for manipulating PropertySources. - * - * @author Dave Syer - * @see PropertySource - * @see PropertySources - * - * Source code copied from spring-boot 1.5.6.RELEASE - */ -public abstract class PropertySourceUtils { - - /** - * Return a Map of all values from the specified {@link PropertySources} that start - * with a particular key. - * @param propertySources the property sources to scan - * @param keyPrefix the key prefixes to test - * @return a map of all sub properties starting with the specified key prefixes. - * @see PropertySourceUtils#getSubProperties(PropertySources, String, String) - */ - public static Map<String, Object> getSubProperties(PropertySources propertySources, - String keyPrefix) { - return PropertySourceUtils.getSubProperties(propertySources, null, keyPrefix); - } - - /** - * Return a Map of all values from the specified {@link PropertySources} that start - * with a particular key. - * @param propertySources the property sources to scan - * @param rootPrefix a root prefix to be prepended to the keyPrefix (can be - * {@code null}) - * @param keyPrefix the key prefixes to test - * @return a map of all sub properties starting with the specified key prefixes. - * @see #getSubProperties(PropertySources, String, String) - */ - public static Map<String, Object> getSubProperties(PropertySources propertySources, - String rootPrefix, String keyPrefix) { - RelaxedNames keyPrefixes = new RelaxedNames(keyPrefix); - Map<String, Object> subProperties = new LinkedHashMap<String, Object>(); - for (PropertySource<?> source : propertySources) { - if (source instanceof EnumerablePropertySource) { - for (String name : ((EnumerablePropertySource<?>) source) - .getPropertyNames()) { - String key = PropertySourceUtils.getSubKey(name, rootPrefix, - keyPrefixes); - if (key != null && !subProperties.containsKey(key)) { - subProperties.put(key, source.getProperty(name)); - } - } - } - } - return Collections.unmodifiableMap(subProperties); - } - - private static String getSubKey(String name, String rootPrefixes, - RelaxedNames keyPrefix) { - rootPrefixes = rootPrefixes == null ? "" : rootPrefixes; - for (String rootPrefix : new RelaxedNames(rootPrefixes)) { - for (String candidateKeyPrefix : keyPrefix) { - if (name.startsWith(rootPrefix + candidateKeyPrefix)) { - return name.substring((rootPrefix + candidateKeyPrefix).length()); - } - } - } - return null; - } - -} diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/RelaxedNames.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/RelaxedNames.java deleted file mode 100644 index 54fbfcd..0000000 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/RelaxedNames.java +++ /dev/null @@ -1,260 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.spring.boot.util; - -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.springframework.util.StringUtils; - -/** - * Generates relaxed name variations from a given source. - * - * @author Phillip Webb - * @author Dave Syer - * @see RelaxedPropertyResolver - * - * Source code copied from spring-boot 1.5.6.RELEASE - */ -public final class RelaxedNames implements Iterable<String> { - - private static final Pattern CAMEL_CASE_PATTERN = Pattern.compile("([^A-Z-])([A-Z])"); - - private static final Pattern SEPARATED_TO_CAMEL_CASE_PATTERN = Pattern - .compile("[_\\-.]"); - - private final String name; - - private final Set<String> values = new LinkedHashSet<String>(); - - /** - * Create a new {@link RelaxedNames} instance. - * @param name the source name. For the maximum number of variations specify the name - * using dashed notation (e.g. {@literal my-property-name} - */ - public RelaxedNames(String name) { - this.name = name == null ? "" : name; - initialize(RelaxedNames.this.name, this.values); - } - - @Override - public Iterator<String> iterator() { - return this.values.iterator(); - } - - private void initialize(String name, Set<String> values) { - if (values.contains(name)) { - return; - } - for (Variation variation : Variation.values()) { - for (Manipulation manipulation : Manipulation.values()) { - String result = name; - result = manipulation.apply(result); - result = variation.apply(result); - values.add(result); - initialize(result, values); - } - } - } - - /** - * Name variations. - */ - enum Variation { - - NONE { - - @Override - public String apply(String value) { - return value; - } - - }, - - LOWERCASE { - - @Override - public String apply(String value) { - return value.isEmpty() ? value : value.toLowerCase(); - } - - }, - - UPPERCASE { - - @Override - public String apply(String value) { - return value.isEmpty() ? value : value.toUpperCase(); - } - - }; - - public abstract String apply(String value); - - } - - /** - * Name manipulations. - */ - enum Manipulation { - - NONE { - - @Override - public String apply(String value) { - return value; - } - - }, - - HYPHEN_TO_UNDERSCORE { - - @Override - public String apply(String value) { - return value.indexOf('-') != -1 ? value.replace('-', '_') : value; - } - - }, - - UNDERSCORE_TO_PERIOD { - - @Override - public String apply(String value) { - return value.indexOf('_') != -1 ? value.replace('_', '.') : value; - } - - }, - - PERIOD_TO_UNDERSCORE { - - @Override - public String apply(String value) { - return value.indexOf('.') != -1 ? value.replace('.', '_') : value; - } - - }, - - CAMELCASE_TO_UNDERSCORE { - - @Override - public String apply(String value) { - if (value.isEmpty()) { - return value; - } - Matcher matcher = CAMEL_CASE_PATTERN.matcher(value); - if (!matcher.find()) { - return value; - } - matcher = matcher.reset(); - StringBuffer result = new StringBuffer(); - while (matcher.find()) { - matcher.appendReplacement(result, matcher.group(1) + '_' - + StringUtils.uncapitalize(matcher.group(2))); - } - matcher.appendTail(result); - return result.toString(); - } - - }, - - CAMELCASE_TO_HYPHEN { - - @Override - public String apply(String value) { - if (value.isEmpty()) { - return value; - } - Matcher matcher = CAMEL_CASE_PATTERN.matcher(value); - if (!matcher.find()) { - return value; - } - matcher = matcher.reset(); - StringBuffer result = new StringBuffer(); - while (matcher.find()) { - matcher.appendReplacement(result, matcher.group(1) + '-' - + StringUtils.uncapitalize(matcher.group(2))); - } - matcher.appendTail(result); - return result.toString(); - } - - }, - - SEPARATED_TO_CAMELCASE { - - @Override - public String apply(String value) { - return separatedToCamelCase(value, false); - } - - }, - - CASE_INSENSITIVE_SEPARATED_TO_CAMELCASE { - - @Override - public String apply(String value) { - return separatedToCamelCase(value, true); - } - - }; - - private static final char[] SUFFIXES = new char[]{'_', '-', '.'}; - - public abstract String apply(String value); - - private static String separatedToCamelCase(String value, - boolean caseInsensitive) { - if (value.isEmpty()) { - return value; - } - StringBuilder builder = new StringBuilder(); - for (String field : SEPARATED_TO_CAMEL_CASE_PATTERN.split(value)) { - field = caseInsensitive ? field.toLowerCase() : field; - builder.append( - builder.length() == 0 ? field : StringUtils.capitalize(field)); - } - char lastChar = value.charAt(value.length() - 1); - for (char suffix : SUFFIXES) { - if (lastChar == suffix) { - builder.append(suffix); - break; - } - } - return builder.toString(); - } - - } - - /** - * Return a {@link RelaxedNames} for the given source camelCase source name. - * @param name the source name in camelCase - * @return the relaxed names - */ - public static RelaxedNames forCamelCase(String name) { - StringBuilder result = new StringBuilder(); - for (char c : name.toCharArray()) { - result.append(Character.isUpperCase(c) && result.length() > 0 - && result.charAt(result.length() - 1) != '-' - ? "-" + Character.toLowerCase(c) : c); - } - return new RelaxedNames(result.toString()); - } - -} diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/RelaxedPropertyResolver.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/RelaxedPropertyResolver.java deleted file mode 100644 index bc26618..0000000 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/RelaxedPropertyResolver.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.spring.boot.util; - -import java.util.Map; - -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.Environment; -import org.springframework.core.env.PropertyResolver; -import org.springframework.core.env.PropertySourcesPropertyResolver; -import org.springframework.util.Assert; - -/** - * {@link PropertyResolver} that attempts to resolve values using {@link RelaxedNames}. - * - * @author Phillip Webb - * @see RelaxedNames - * - * Source code copied from spring-boot 1.5.6.RELEASE - */ -public class RelaxedPropertyResolver implements PropertyResolver { - - private final PropertyResolver resolver; - - private final String prefix; - - public RelaxedPropertyResolver(PropertyResolver resolver) { - this(resolver, null); - } - - public RelaxedPropertyResolver(PropertyResolver resolver, String prefix) { - Assert.notNull(resolver, "PropertyResolver must not be null"); - this.resolver = resolver; - this.prefix = prefix == null ? "" : prefix; - } - - @Override - public String getRequiredProperty(String key) throws IllegalStateException { - return getRequiredProperty(key, String.class); - } - - @Override - public <T> T getRequiredProperty(String key, Class<T> targetType) - throws IllegalStateException { - T value = getProperty(key, targetType); - Assert.state(value != null, String.format("required key [%s] not found", key)); - return value; - } - - @Override - public String getProperty(String key) { - return getProperty(key, String.class, null); - } - - @Override - public String getProperty(String key, String defaultValue) { - return getProperty(key, String.class, defaultValue); - } - - @Override - public <T> T getProperty(String key, Class<T> targetType) { - return getProperty(key, targetType, null); - } - - @Override - public <T> T getProperty(String key, Class<T> targetType, T defaultValue) { - RelaxedNames prefixes = new RelaxedNames(this.prefix); - RelaxedNames keys = new RelaxedNames(key); - for (String prefix : prefixes) { - for (String relaxedKey : keys) { - if (this.resolver.containsProperty(prefix + relaxedKey)) { - return this.resolver.getProperty(prefix + relaxedKey, targetType); - } - } - } - return defaultValue; - } - - // not implemented in spring boot 2 and not in use by us - public <T> Class<T> getPropertyAsClass(String key, Class<T> targetType) { - return null; - } - - @Override - public boolean containsProperty(String key) { - RelaxedNames prefixes = new RelaxedNames(this.prefix); - RelaxedNames keys = new RelaxedNames(key); - for (String prefix : prefixes) { - for (String relaxedKey : keys) { - if (this.resolver.containsProperty(prefix + relaxedKey)) { - return true; - } - } - } - return false; - } - - @Override - public String resolvePlaceholders(String text) { - throw new UnsupportedOperationException( - "Unable to resolve placeholders with relaxed properties"); - } - - @Override - public String resolveRequiredPlaceholders(String text) - throws IllegalArgumentException { - throw new UnsupportedOperationException( - "Unable to resolve placeholders with relaxed properties"); - } - - /** - * Return a Map of all values from all underlying properties that start with the - * specified key. NOTE: this method can only be used if the underlying resolver is a - * {@link ConfigurableEnvironment}. - * @param keyPrefix the key prefix used to filter results - * @return a map of all sub properties starting with the specified key prefix. - * @see PropertySourceUtils#getSubProperties - */ - public Map<String, Object> getSubProperties(String keyPrefix) { - Assert.isInstanceOf(ConfigurableEnvironment.class, this.resolver, - "SubProperties not available."); - ConfigurableEnvironment env = (ConfigurableEnvironment) this.resolver; - return PropertySourceUtils.getSubProperties(env.getPropertySources(), this.prefix, - keyPrefix); - } - - /** - * Return a property resolver for the environment, preferring one that ignores - * unresolvable nested placeholders. - * @param environment the source environment - * @param prefix the prefix - * @return a property resolver for the environment - * @since 1.4.3 - */ - public static RelaxedPropertyResolver ignoringUnresolvableNestedPlaceholders( - Environment environment, String prefix) { - Assert.notNull(environment, "Environment must not be null"); - PropertyResolver resolver = environment; - if (environment instanceof ConfigurableEnvironment) { - resolver = new PropertySourcesPropertyResolver( - ((ConfigurableEnvironment) environment).getPropertySources()); - ((PropertySourcesPropertyResolver) resolver) - .setIgnoreUnresolvableNestedPlaceholders(true); - } - return new RelaxedPropertyResolver(resolver, prefix); - } - -} diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/springboot/HazelcastComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/springboot/HazelcastComponentAutoConfiguration.java index d6de019..ed00daf 100644 --- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/springboot/HazelcastComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/springboot/HazelcastComponentAutoConfiguration.java @@ -21,7 +21,6 @@ import java.util.Map; import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.hazelcast.HazelcastComponent; -import org.apache.camel.spring.boot.util.RelaxedPropertyResolver; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionMessage; @@ -31,6 +30,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.context.properties.bind.Bindable; +import org.springframework.boot.context.properties.bind.Binder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.Conditional; @@ -106,9 +107,8 @@ public class HazelcastComponentAutoConfiguration { private boolean isEnabled( org.springframework.context.annotation.ConditionContext context, java.lang.String prefix, boolean defaultValue) { - RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( - context.getEnvironment(), prefix); - return resolver.getProperty("enabled", Boolean.class, defaultValue); + String property = prefix.endsWith(".") ? prefix + "enabled" : prefix + ".enabled"; + return Binder.get(context.getEnvironment()).bind(property, Bindable.of(Boolean.class)).orElse(defaultValue); } } } \ No newline at end of file diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java index 4ca37ef..ecb86ac 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java @@ -2241,7 +2241,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { parentClass.addImport(ConditionMessage.class); parentClass.addImport(ConditionContext.class); parentClass.addImport(ConditionOutcome.class); - parentClass.addImport("org.apache.camel.spring.boot.util.RelaxedPropertyResolver"); + parentClass.addImport("org.springframework.boot.context.properties.bind.Bindable"); + parentClass.addImport("org.springframework.boot.context.properties.bind.Binder"); parentClass.addImport(AnnotatedTypeMetadata.class); parentClass.addImport(SpringBootCondition.class); @@ -2263,8 +2264,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { isEnabled.addParameter(boolean.class, "defaultValue"); isEnabled.setReturnType(boolean.class); isEnabled.setBody(new StringBuilder() - .append("RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), prefix);\n") - .append("return resolver.getProperty(\"enabled\", Boolean.class, defaultValue);") + .append("String property = prefix.endsWith(\".\") ? prefix + \"enabled\" : prefix + \".enabled\";\n") + .append("return Binder.get(context.getEnvironment()).bind(property, Bindable.of(Boolean.class)).orElse(defaultValue);") .toString() ); -- To stop receiving notification emails like this one, please contact nferr...@apache.org.