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
110c36e6
Commit
110c36e6
authored
May 19, 2021
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.4.x' into main
Closes gh-26610
parents
8a3f835f
80610fa2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
Profiles.java
...ava/org/springframework/boot/context/config/Profiles.java
+5
-4
SpringApplicationTests.java
...java/org/springframework/boot/SpringApplicationTests.java
+2
-3
ConfigDataEnvironmentPostProcessorIntegrationTests.java
...g/ConfigDataEnvironmentPostProcessorIntegrationTests.java
+1
-1
ProfilesTests.java
...rg/springframework/boot/context/config/ProfilesTests.java
+2
-2
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/Profiles.java
View file @
110c36e6
...
...
@@ -148,15 +148,16 @@ public class Profiles implements Iterable<String> {
return
reversed
;
}
private
List
<
String
>
asUniqueItemList
(
Collection
<
String
>
string
s
)
{
return
asUniqueItemList
(
string
s
,
null
);
private
List
<
String
>
asUniqueItemList
(
Collection
<
String
>
profile
s
)
{
return
asUniqueItemList
(
profile
s
,
null
);
}
private
List
<
String
>
asUniqueItemList
(
Collection
<
String
>
string
s
,
Collection
<
String
>
additional
)
{
LinkedHashSet
<
String
>
uniqueItems
=
new
LinkedHashSet
<>(
strings
);
private
List
<
String
>
asUniqueItemList
(
Collection
<
String
>
profile
s
,
Collection
<
String
>
additional
)
{
LinkedHashSet
<
String
>
uniqueItems
=
new
LinkedHashSet
<>();
if
(!
CollectionUtils
.
isEmpty
(
additional
))
{
uniqueItems
.
addAll
(
additional
);
}
uniqueItems
.
addAll
(
profiles
);
return
Collections
.
unmodifiableList
(
new
ArrayList
<>(
uniqueItems
));
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
View file @
110c36e6
...
...
@@ -592,15 +592,14 @@ class SpringApplicationTests {
}
@Test
void
add
ProfilesOrder
()
{
void
add
itionalProfilesOrderedBeforeActiveProfiles
()
{
SpringApplication
application
=
new
SpringApplication
(
ExampleConfig
.
class
);
application
.
setWebApplicationType
(
WebApplicationType
.
NONE
);
application
.
setAdditionalProfiles
(
"foo"
);
ConfigurableEnvironment
environment
=
new
StandardEnvironment
();
application
.
setEnvironment
(
environment
);
this
.
context
=
application
.
run
(
"--spring.profiles.active=bar,spam"
);
// Since Boot 2.4 additional should always be last
assertThat
(
environment
.
getActiveProfiles
()).
containsExactly
(
"bar"
,
"spam"
,
"foo"
);
assertThat
(
environment
.
getActiveProfiles
()).
containsExactly
(
"foo"
,
"bar"
,
"spam"
);
}
@Test
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java
View file @
110c36e6
...
...
@@ -308,7 +308,7 @@ class ConfigDataEnvironmentPostProcessorIntegrationTests {
void
runWhenProfilesPresentBeforeConfigFileProcessingAugmentsProfileActivatedByConfigFile
()
{
this
.
application
.
setAdditionalProfiles
(
"other"
);
ConfigurableApplicationContext
context
=
this
.
application
.
run
(
"--spring.config.name=enableprofile"
);
assertThat
(
context
.
getEnvironment
().
getActiveProfiles
()).
containsExactly
(
"
myprofile"
,
"other
"
);
assertThat
(
context
.
getEnvironment
().
getActiveProfiles
()).
containsExactly
(
"
other"
,
"myprofile
"
);
String
property
=
context
.
getEnvironment
().
getProperty
(
"other.property"
);
assertThat
(
property
).
isEqualTo
(
"fromotherpropertiesfile"
);
property
=
context
.
getEnvironment
().
getProperty
(
"the.property"
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ProfilesTests.java
View file @
110c36e6
...
...
@@ -143,9 +143,9 @@ class ProfilesTests {
@Test
void
getActiveWhenHasAdditionalIncludesAdditional
()
{
MockEnvironment
environment
=
new
MockEnvironment
();
environment
.
setProperty
(
"spring.profiles.active"
,
"
a,b,c
"
);
environment
.
setProperty
(
"spring.profiles.active"
,
"
d,e,f
"
);
Binder
binder
=
Binder
.
get
(
environment
);
Profiles
profiles
=
new
Profiles
(
environment
,
binder
,
Arrays
.
asList
(
"
d"
,
"e"
,
"f
"
));
Profiles
profiles
=
new
Profiles
(
environment
,
binder
,
Arrays
.
asList
(
"
a"
,
"b"
,
"c
"
));
assertThat
(
profiles
.
getActive
()).
containsExactly
(
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
);
}
...
...
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