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
7cd31594
Commit
7cd31594
authored
Apr 05, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish contribution
Closes gh-5561
parent
4353963d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
40 deletions
+12
-40
ConfigFileApplicationListenerTests.java
...ot/context/config/ConfigFileApplicationListenerTests.java
+7
-26
testsetmultiprofiles.yml
spring-boot/src/test/resources/testsetmultiprofiles.yml
+1
-14
testsetmultiprofileswhitespace.yml
...oot/src/test/resources/testsetmultiprofileswhitespace.yml
+4
-0
No files found.
spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java
View file @
7cd31594
...
@@ -535,32 +535,13 @@ public class ConfigFileApplicationListenerTests {
...
@@ -535,32 +535,13 @@ public class ConfigFileApplicationListenerTests {
this
.
initializer
.
setSearchNames
(
"testsetmultiprofiles"
);
this
.
initializer
.
setSearchNames
(
"testsetmultiprofiles"
);
this
.
initializer
.
postProcessEnvironment
(
this
.
environment
,
this
.
application
);
this
.
initializer
.
postProcessEnvironment
(
this
.
environment
,
this
.
application
);
assertThat
(
this
.
environment
.
getActiveProfiles
()).
containsExactly
(
"dev"
,
"healthcheck"
);
assertThat
(
this
.
environment
.
getActiveProfiles
()).
containsExactly
(
"dev"
,
"healthcheck"
);
String
property
=
this
.
environment
.
getProperty
(
"my.property"
);
}
String
property2
=
this
.
environment
.
getProperty
(
"my.property2"
);
assertThat
(
property
).
isEqualTo
(
"fromdevprofile"
);
@Test
assertThat
(
property2
).
isEqualTo
(
"fromhealthcheckprofile"
);
public
void
yamlSetsMultiProfilesWithWithespace
()
throws
Exception
{
ConfigurationPropertySources
propertySource
=
(
ConfigurationPropertySources
)
this
.
environment
this
.
initializer
.
setSearchNames
(
"testsetmultiprofileswhitespace"
);
.
getPropertySources
()
this
.
initializer
.
postProcessEnvironment
(
this
.
environment
,
this
.
application
);
.
get
(
ConfigFileApplicationListener
.
APPLICATION_CONFIGURATION_PROPERTY_SOURCE_NAME
);
assertThat
(
this
.
environment
.
getActiveProfiles
()).
containsExactly
(
"dev"
,
"healthcheck"
);
Collection
<
org
.
springframework
.
core
.
env
.
PropertySource
<?>>
sources
=
propertySource
.
getSource
();
assertThat
(
sources
).
hasSize
(
3
);
List
<
String
>
names
=
new
ArrayList
<
String
>();
for
(
org
.
springframework
.
core
.
env
.
PropertySource
<?>
source
:
sources
)
{
if
(
source
instanceof
EnumerableCompositePropertySource
)
{
for
(
org
.
springframework
.
core
.
env
.
PropertySource
<?>
nested
:
((
EnumerableCompositePropertySource
)
source
)
.
getSource
())
{
names
.
add
(
nested
.
getName
());
}
}
else
{
names
.
add
(
source
.
getName
());
}
}
assertThat
(
names
).
contains
(
"applicationConfig: [classpath:/testsetmultiprofiles.yml]#healthcheck"
,
"applicationConfig: [classpath:/testsetmultiprofiles.yml]#dev"
,
"applicationConfig: [classpath:/testsetmultiprofiles.yml]"
);
}
}
@Test
@Test
...
...
spring-boot/src/test/resources/testsetmultiprofiles.yml
View file @
7cd31594
---
---
spring
:
spring
:
profiles
:
profiles
:
active
:
dev, healthcheck
active
:
dev,healthcheck
my
:
\ No newline at end of file
property
:
fromyamlfile
property2
:
fromyamlfile
---
spring
:
profiles
:
dev
my
:
property
:
fromdevprofile
---
spring
:
profiles
:
healthcheck
my
:
property2
:
fromhealthcheckprofile
\ No newline at end of file
spring-boot/src/test/resources/testsetmultiprofileswhitespace.yml
0 → 100644
View file @
7cd31594
---
spring
:
profiles
:
active
:
dev, healthcheck
\ No newline at end of file
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