Skip to content

Commit f90f29d

Browse files
Polish "Resolve property placeholders when binding properties to a Map"
See gh-39507
1 parent 8292104 commit f90f29d

File tree

2 files changed

+5
-5
lines changed
  • spring-boot-project/spring-boot/src

2 files changed

+5
-5
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -64,8 +64,7 @@ protected Object bindAggregate(ConfigurationPropertyName name, Bindable<?> targe
6464
getContext().setConfigurationProperty(property);
6565
Object result = property.getValue();
6666
result = getContext().getPlaceholdersResolver().resolvePlaceholders(result);
67-
result = getContext().getConverter().convert(result, target);
68-
return result;
67+
return getContext().getConverter().convert(result, target);
6968
}
7069
source = source.filter(name::isAncestorOf);
7170
}

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -615,7 +615,8 @@ void bindToMapWithPlaceholdersShouldResolve() {
615615
DefaultConversionService conversionService = new DefaultConversionService();
616616
conversionService.addConverter(new MapConverter());
617617
StandardEnvironment environment = new StandardEnvironment();
618-
Binder binder = new Binder(this.sources, new PropertySourcesPlaceholdersResolver(environment), conversionService, null, null);
618+
Binder binder = new Binder(this.sources, new PropertySourcesPlaceholdersResolver(environment),
619+
conversionService, null, null);
619620
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, "bar=bc");
620621
this.sources.add(new MockConfigurationPropertySource("foo", "a${bar},${bar}d"));
621622
Map<String, String> map = binder.bind("foo", STRING_STRING_MAP).get();

0 commit comments

Comments
 (0)