Browse Source

Merge branch '2.4.x'

See gh-26654
pull/26677/head
Stephane Nicoll 5 years ago
parent
commit
e5ee1eb86f
  1. 10
      spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/profiles.adoc
  2. 18
      spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/properties-and-configuration.adoc

10
spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/profiles.adoc

@ -24,6 +24,16 @@ For example, you could include it in your `application.properties`, as shown in @@ -24,6 +24,16 @@ 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`.
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,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
profiles:
default: "none"
----
[[features.profiles.adding-active-profiles]]

18
spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/properties-and-configuration.adoc

@ -239,6 +239,24 @@ See "`<<features#features.profiles>>`" in the "`Spring Boot features`" section f @@ -239,6 +239,24 @@ See "`<<features#features.profiles>>`" in the "`Spring Boot features`" section f
[[howto.properties-and-configuration.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,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
profiles:
default: "dev"
----
See "`<<features#features.profiles>>`" in the "`Spring Boot features`" section for more information.
[[howto.properties-and-configuration.change-configuration-depending-on-the-environment]]
=== Change Configuration Depending on the Environment
Spring Boot supports multi-document YAML and Properties files (see <<features#features.external-config.files.multi-document>> for details) which can be activated conditionally based on the active profiles.

Loading…
Cancel
Save