|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2023 the original author or authors. |
| 2 | + * Copyright 2012-2024 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -610,6 +610,20 @@ void bindToMapWithWildcardShouldConvertToTheRightType() {
|
610 | 610 | .containsExactly("127.0.0.1", "127.0.0.2");
|
611 | 611 | }
|
612 | 612 |
|
| 613 | + @Test |
| 614 | + void bindToMapWithPlaceholdersShouldResolve() { |
| 615 | + DefaultConversionService conversionService = new DefaultConversionService(); |
| 616 | + conversionService.addConverter(new MapConverter()); |
| 617 | + StandardEnvironment environment = new StandardEnvironment(); |
| 618 | + Binder binder = new Binder(this.sources, new PropertySourcesPlaceholdersResolver(environment), |
| 619 | + conversionService, null, null); |
| 620 | + TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, "bar=bc"); |
| 621 | + this.sources.add(new MockConfigurationPropertySource("foo", "a${bar},${bar}d")); |
| 622 | + Map<String, String> map = binder.bind("foo", STRING_STRING_MAP).get(); |
| 623 | + assertThat(map).containsKey("abc"); |
| 624 | + assertThat(map).containsKey("bcd"); |
| 625 | + } |
| 626 | + |
613 | 627 | private <K, V> Bindable<Map<K, V>> getMapBindable(Class<K> keyGeneric, ResolvableType valueType) {
|
614 | 628 | ResolvableType keyType = ResolvableType.forClass(keyGeneric);
|
615 | 629 | return Bindable.of(ResolvableType.forClassWithGenerics(Map.class, keyType, valueType));
|
|
0 commit comments