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
fc8fdf2d
Commit
fc8fdf2d
authored
Jun 02, 2020
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.3.x'
Closes gh-21656
parents
399d0f7b
2589f980
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
SpringConfigurationPropertySource.java
.../properties/source/SpringConfigurationPropertySource.java
+1
-1
SpringConfigurationPropertySourceTests.java
...erties/source/SpringConfigurationPropertySourceTests.java
+25
-0
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java
View file @
fc8fdf2d
...
@@ -104,7 +104,7 @@ class SpringConfigurationPropertySource implements ConfigurationPropertySource {
...
@@ -104,7 +104,7 @@ class SpringConfigurationPropertySource implements ConfigurationPropertySource {
}
}
private
static
ConfigurationPropertyState
containsDescendantOfForRandom
(
ConfigurationPropertyName
name
)
{
private
static
ConfigurationPropertyState
containsDescendantOfForRandom
(
ConfigurationPropertyName
name
)
{
if
(
name
.
isAncestorOf
(
RANDOM
)
||
name
.
equals
(
RANDOM
))
{
if
(
RANDOM
.
isAncestorOf
(
name
)
||
name
.
equals
(
RANDOM
))
{
return
ConfigurationPropertyState
.
PRESENT
;
return
ConfigurationPropertyState
.
PRESENT
;
}
}
return
ConfigurationPropertyState
.
ABSENT
;
return
ConfigurationPropertyState
.
ABSENT
;
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourceTests.java
View file @
fc8fdf2d
...
@@ -21,6 +21,7 @@ import java.util.Map;
...
@@ -21,6 +21,7 @@ import java.util.Map;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.env.RandomValuePropertySource
;
import
org.springframework.boot.origin.Origin
;
import
org.springframework.boot.origin.Origin
;
import
org.springframework.boot.origin.OriginLookup
;
import
org.springframework.boot.origin.OriginLookup
;
import
org.springframework.core.env.MapPropertySource
;
import
org.springframework.core.env.MapPropertySource
;
...
@@ -141,6 +142,30 @@ class SpringConfigurationPropertySourceTests {
...
@@ -141,6 +142,30 @@ class SpringConfigurationPropertySourceTests {
.
isInstanceOf
(
IterableConfigurationPropertySource
.
class
);
.
isInstanceOf
(
IterableConfigurationPropertySource
.
class
);
}
}
@Test
void
containsDescendantOfWhenRandomSourceAndRandomPropertyReturnsPresent
()
{
SpringConfigurationPropertySource
source
=
SpringConfigurationPropertySource
.
from
(
new
RandomValuePropertySource
());
assertThat
(
source
.
containsDescendantOf
(
ConfigurationPropertyName
.
of
(
"random"
)))
.
isEqualTo
(
ConfigurationPropertyState
.
PRESENT
);
}
@Test
void
containsDescendantOfWhenRandomSourceAndRandomPrefixedPropertyReturnsPresent
()
{
SpringConfigurationPropertySource
source
=
SpringConfigurationPropertySource
.
from
(
new
RandomValuePropertySource
());
assertThat
(
source
.
containsDescendantOf
(
ConfigurationPropertyName
.
of
(
"random.something"
)))
.
isEqualTo
(
ConfigurationPropertyState
.
PRESENT
);
}
@Test
void
containsDescendantOfWhenRandomSourceAndNonRandomPropertyReturnsAbsent
()
{
SpringConfigurationPropertySource
source
=
SpringConfigurationPropertySource
.
from
(
new
RandomValuePropertySource
());
assertThat
(
source
.
containsDescendantOf
(
ConfigurationPropertyName
.
of
(
"abandon.something"
)))
.
isEqualTo
(
ConfigurationPropertyState
.
ABSENT
);
}
/**
/**
* Test {@link PropertySource} that's also an {@link OriginLookup}.
* Test {@link PropertySource} that's also an {@link OriginLookup}.
*
*
...
...
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