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
eb49f4bf
Commit
eb49f4bf
authored
Jul 03, 2015
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation for default profiles
parent
dc8ba2c5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
+33
-3
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+33
-3
No files found.
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
eb49f4bf
...
@@ -380,10 +380,13 @@ environment variables or system properties.
...
@@ -380,10 +380,13 @@ environment variables or system properties.
[[boot-features-external-config-profile-specific-properties]]
[[boot-features-external-config-profile-specific-properties]]
=== Profile-specific properties
=== Profile-specific properties
In addition to `application.properties` files, profile-specific properties can also be
In addition to `application.properties` files, profile-specific properties can also be
defined using the naming convention `application-{profile}.properties`.
defined using the naming convention `application-{profile}.properties`. The
`Environment` has a set of default profiles (by default `[default]`) which are
used if no active profiels are set (i.e. if no profiles are explicitly activated
then properties from `application-default.properties` are loaded).
Profile specific properties are loaded from the same locations as standard
Profile specific properties are loaded from the same locations as standard
`application.properties`, with profile-specific files always overriding the
default
`application.properties`, with profile-specific files always overriding the
non-specific
ones irrespective of whether the profile-specific files are inside or outside your
ones irrespective of whether the profile-specific files are inside or outside your
packaged jar.
packaged jar.
...
@@ -518,8 +521,35 @@ using a `spring.profiles` key to indicate when the document applies. For example
...
@@ -518,8 +521,35 @@ using a `spring.profiles` key to indicate when the document applies. For example
In the example above, the `server.address` property will be `127.0.0.1` if the
In the example above, the `server.address` property will be `127.0.0.1` if the
`development` profile is active. If the `development` and `production` profiles are *not*
`development` profile is active. If the `development` and `production` profiles are *not*
enabled, then the value for the property will be `192.168.1.100`
enabled, then the value for the property will be `192.168.1.100`
.
The default profiles are activated if none are explicitly active when the application
context starts. So in this YAML we set a value for `security.user.password` that is
*only* available in the "default" profile:
[source,yaml,indent=0]
----
server:
port: 80000
---
spring:
profiles: default
security:
user:
password: weak
----
whereas in this example, the password is always set because it isn't attached to any profile,
and it would have to be explicitly reset in all other profiles as necessary:
[source,yaml,indent=0]
----
server:
port: 80000
security:
user:
password: weak
----
[[boot-features-external-config-yaml-shortcomings]]
[[boot-features-external-config-yaml-shortcomings]]
...
...
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