Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
743cf3b2
Commit
743cf3b2
authored
Jan 03, 2020
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x'
Closes gh-19527
parents
cc154bbe
ac46f597
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
pom.xml
spring-boot-project/spring-boot-dependencies/pom.xml
+1
-1
MapBinderTests.java
...ramework/boot/context/properties/bind/MapBinderTests.java
+27
-0
No files found.
spring-boot-project/spring-boot-dependencies/pom.xml
View file @
743cf3b2
...
...
@@ -189,7 +189,7 @@
<spring-batch.version>
4.2.1.RELEASE
</spring-batch.version>
<spring-cloud-connectors.version>
2.0.7.RELEASE
</spring-cloud-connectors.version>
<spring-data-releasetrain.version>
Moore-SR3
</spring-data-releasetrain.version>
<spring-framework.version>
5.2.
2.RELEASE
</spring-framework.version>
<spring-framework.version>
5.2.
3.BUILD-SNAPSHOT
</spring-framework.version>
<spring-hateoas.version>
1.0.2.RELEASE
</spring-hateoas.version>
<spring-integration.version>
5.2.2.RELEASE
</spring-integration.version>
<spring-kafka.version>
2.3.4.RELEASE
</spring-kafka.version>
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java
View file @
743cf3b2
...
...
@@ -16,6 +16,7 @@
package
org
.
springframework
.
boot
.
context
.
properties
.
bind
;
import
java.net.InetAddress
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
...
...
@@ -592,6 +593,18 @@ class MapBinderTests {
assertThat
(
result
.
getValues
()).
containsExactly
(
entry
(
"a"
,
"b"
));
}
@Test
public
void
bindToMapWithWildcardShouldConvertToTheRightType
()
{
// gh-18767
MockConfigurationPropertySource
source
=
new
MockConfigurationPropertySource
();
source
.
put
(
"foo.addresses.localhost[0]"
,
"127.0.0.1"
);
source
.
put
(
"foo.addresses.localhost[1]"
,
"127.0.0.2"
);
this
.
sources
.
add
(
source
);
MapWithWildcardProperties
result
=
this
.
binder
.
bind
(
"foo"
,
Bindable
.
of
(
MapWithWildcardProperties
.
class
)).
get
();
assertThat
(
result
.
getAddresses
().
get
(
"localhost"
).
stream
().
map
(
InetAddress:
:
getHostAddress
))
.
containsExactly
(
"127.0.0.1"
,
"127.0.0.2"
);
}
private
<
K
,
V
>
Bindable
<
Map
<
K
,
V
>>
getMapBindable
(
Class
<
K
>
keyGeneric
,
ResolvableType
valueType
)
{
ResolvableType
keyType
=
ResolvableType
.
forClass
(
keyGeneric
);
return
Bindable
.
of
(
ResolvableType
.
forClassWithGenerics
(
Map
.
class
,
keyType
,
valueType
));
...
...
@@ -707,4 +720,18 @@ class MapBinderTests {
}
static
class
MapWithWildcardProperties
{
private
Map
<
String
,
?
extends
List
<?
extends
InetAddress
>>
addresses
;
Map
<
String
,
?
extends
List
<?
extends
InetAddress
>>
getAddresses
()
{
return
this
.
addresses
;
}
void
setAddresses
(
Map
<
String
,
?
extends
List
<?
extends
InetAddress
>>
addresses
)
{
this
.
addresses
=
addresses
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment