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
96823869
Commit
96823869
authored
Apr 15, 2021
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.4.x'
Closes gh-26139
parents
5142fe9b
302d500e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
StandardConfigDataReference.java
...work/boot/context/config/StandardConfigDataReference.java
+4
-0
StandardConfigDataResource.java
...ework/boot/context/config/StandardConfigDataResource.java
+9
-0
ConfigDataEnvironmentPostProcessorTests.java
...ntext/config/ConfigDataEnvironmentPostProcessorTests.java
+7
-0
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataReference.java
View file @
96823869
...
...
@@ -74,6 +74,10 @@ class StandardConfigDataReference {
return
this
.
directory
;
}
String
getProfile
()
{
return
this
.
profile
;
}
boolean
isSkippable
()
{
return
this
.
configDataLocation
.
isOptional
()
||
this
.
directory
!=
null
||
this
.
profile
!=
null
;
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataResource.java
View file @
96823869
...
...
@@ -74,6 +74,15 @@ public class StandardConfigDataResource extends ConfigDataResource {
return
this
.
resource
;
}
/**
* Return the profile or {@code null} if the resource is not profile specific.
* @return the profile or {@code null}
* @since 2.4.6
*/
public
String
getProfile
()
{
return
this
.
reference
.
getProfile
();
}
boolean
isEmptyDirectory
()
{
return
this
.
emptyDirectory
;
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorTests.java
View file @
96823869
...
...
@@ -127,6 +127,13 @@ class ConfigDataEnvironmentPostProcessorTests {
assertThat
(
this
.
environment
.
getActiveProfiles
()).
containsExactly
(
"dev"
);
assertThat
(
listener
.
getAddedPropertySources
()).
hasSizeGreaterThan
(
0
);
assertThat
(
listener
.
getProfiles
().
getActive
()).
containsExactly
(
"dev"
);
assertThat
(
listener
.
getAddedPropertySources
().
stream
().
anyMatch
((
added
)
->
hasDevProfile
(
added
.
getResource
())))
.
isTrue
();
}
private
boolean
hasDevProfile
(
ConfigDataResource
resource
)
{
return
(
resource
instanceof
StandardConfigDataResource
)
&&
"dev"
.
equals
(((
StandardConfigDataResource
)
resource
).
getProfile
());
}
}
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