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
ffe2e9b6
Commit
ffe2e9b6
authored
Aug 06, 2015
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify javadoc of SpringApplication.configureProfiles
Closes gh-2671
parent
1a11ed20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
SpringApplication.java
...main/java/org/springframework/boot/SpringApplication.java
+7
-6
No files found.
spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
View file @
ffe2e9b6
...
...
@@ -37,6 +37,7 @@ import org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader;
import
org.springframework.beans.factory.support.BeanDefinitionRegistry
;
import
org.springframework.beans.factory.support.BeanNameGenerator
;
import
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
;
import
org.springframework.boot.context.config.ConfigFileApplicationListener
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextInitializer
;
import
org.springframework.context.ApplicationListener
;
...
...
@@ -191,7 +192,7 @@ public class SpringApplication {
private
Map
<
String
,
Object
>
defaultProperties
;
private
Set
<
String
>
p
rofiles
=
new
HashSet
<
String
>();
private
Set
<
String
>
additionalP
rofiles
=
new
HashSet
<
String
>();
/**
* Create a new {@link SpringApplication} instance. The application context will load
...
...
@@ -450,17 +451,17 @@ public class SpringApplication {
/**
* Configure which profiles are active (or active by default) for this application
* environment. Consider overriding this method to programmatically enforce profile
* rules and semantics, such as ensuring mutual exclusivity of profiles (e.g. 'dev' OR
* 'prod', but never both).
* environment. Additional profiles may be activated during configuration file
* processing via the {@code spring.profiles.active} property.
* @param environment this application's environment
* @param args arguments passed to the {@code run} method
* @see #configureEnvironment(ConfigurableEnvironment, String[])
* @see ConfigFileApplicationListener
*/
protected
void
configureProfiles
(
ConfigurableEnvironment
environment
,
String
[]
args
)
{
environment
.
getActiveProfiles
();
// ensure they are initialized
// But these ones should go first (last wins in a property key clash)
Set
<
String
>
profiles
=
new
LinkedHashSet
<
String
>(
this
.
p
rofiles
);
Set
<
String
>
profiles
=
new
LinkedHashSet
<
String
>(
this
.
additionalP
rofiles
);
profiles
.
addAll
(
Arrays
.
asList
(
environment
.
getActiveProfiles
()));
environment
.
setActiveProfiles
(
profiles
.
toArray
(
new
String
[
profiles
.
size
()]));
}
...
...
@@ -822,7 +823,7 @@ public class SpringApplication {
* @param profiles the additional profiles to set
*/
public
void
setAdditionalProfiles
(
String
...
profiles
)
{
this
.
p
rofiles
=
new
LinkedHashSet
<
String
>(
Arrays
.
asList
(
profiles
));
this
.
additionalP
rofiles
=
new
LinkedHashSet
<
String
>(
Arrays
.
asList
(
profiles
));
}
/**
...
...
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