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
ce512a18
Commit
ce512a18
authored
Aug 10, 2015
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test to support binding nested properties
See gh-3539
parent
2985b0e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
ConfigurationPropertiesBindingPostProcessorTests.java
...ies/ConfigurationPropertiesBindingPostProcessorTests.java
+44
-0
No files found.
spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessorTests.java
View file @
ce512a18
...
...
@@ -293,6 +293,17 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
equalTo
(
"test2"
));
}
@Test
public
void
nestedProperties
()
throws
Exception
{
// gh-3539
this
.
context
=
new
AnnotationConfigApplicationContext
();
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"TEST_NESTED_VALUE:test1"
);
this
.
context
.
register
(
PropertyWithNestedValue
.
class
);
this
.
context
.
refresh
();
assertThat
(
this
.
context
.
getBean
(
PropertyWithNestedValue
.
class
).
getNested
()
.
getValue
(),
equalTo
(
"test1"
));
}
@Configuration
@EnableConfigurationProperties
public
static
class
TestConfigurationWithValidatingSetter
{
...
...
@@ -612,4 +623,37 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
}
@Configuration
@EnableConfigurationProperties
@ConfigurationProperties
(
prefix
=
"test"
)
public
static
class
PropertyWithNestedValue
{
private
Nested
nested
=
new
Nested
();
public
Nested
getNested
()
{
return
this
.
nested
;
}
@Bean
public
static
PropertySourcesPlaceholderConfigurer
configurer
()
{
return
new
PropertySourcesPlaceholderConfigurer
();
}
public
static
class
Nested
{
@Value
(
"${default.value}"
)
private
String
value
;
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
String
getValue
()
{
return
this
.
value
;
}
}
}
}
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