mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Document spring.profiles.default in the reference guide
Closes gh-26592
This commit is contained in:
parent
39e3746cf6
commit
3fbf5eeb5b
@ -349,6 +349,22 @@ See "`<<spring-boot-features.adoc#boot-features-profiles>>`" in the "`Spring Boo
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[[howto-set-default-spring-profile-name]]
|
||||||
|
=== Set the Default Profile Name
|
||||||
|
The default profile is a profile that is enabled if no profile is active.
|
||||||
|
By default, the name of the default profile is `default`, but it could be changed using a System property (configprop:spring.profiles.default[]) or an OS environment variable (configprop:spring.profiles.default[format=envvar]).
|
||||||
|
|
||||||
|
In Spring Boot, you can also set the default profile name in `application.properties`, as shown in the following example:
|
||||||
|
|
||||||
|
[source,properties,indent=0,subs="verbatim,quotes,attributes",configprops]
|
||||||
|
----
|
||||||
|
spring.profiles.default=dev
|
||||||
|
----
|
||||||
|
|
||||||
|
See "`<<spring-boot-features.adoc#boot-features-profiles>>`" in the "`Spring Boot features`" section for more information.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[howto-change-configuration-depending-on-the-environment]]
|
[[howto-change-configuration-depending-on-the-environment]]
|
||||||
=== Change Configuration Depending on the Environment
|
=== Change Configuration Depending on the Environment
|
||||||
A YAML file is actually a sequence of documents separated by `---` lines, and each document is parsed separately to a flattened map.
|
A YAML file is actually a sequence of documents separated by `---` lines, and each document is parsed separately to a flattened map.
|
||||||
|
@ -1667,6 +1667,14 @@ For example, you could include it in your `application.properties`, as shown in
|
|||||||
|
|
||||||
You could also specify it on the command line by using the following switch: `--spring.profiles.active=dev,hsqldb`.
|
You could also specify it on the command line by using the following switch: `--spring.profiles.active=dev,hsqldb`.
|
||||||
|
|
||||||
|
If no profile is active, a default profile is enabled.
|
||||||
|
The name of the default profile is `default` and it can be tuned using the configprop:spring.profiles.default[] `Environment` property, as shown in the following example:
|
||||||
|
|
||||||
|
[source,properties,indent=0,configprops]
|
||||||
|
----
|
||||||
|
spring.profiles.default=none
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[boot-features-adding-active-profiles]]
|
[[boot-features-adding-active-profiles]]
|
||||||
|
Loading…
Reference in New Issue
Block a user