Skip to content

Commit 454d72d

Browse files
committed
Document spring.profiles.default in the reference guide
Closes gh-26592
1 parent 49c3085 commit 454d72d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto.adoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,22 @@ See "`<<spring-boot-features.adoc#boot-features-profiles>>`" in the "`Spring Boo
359359

360360

361361

362+
[[howto-set-default-spring-profile-name]]
363+
=== Set the Default Profile Name
364+
The default profile is a profile that is enabled if no profile is active.
365+
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]).
366+
367+
In Spring Boot, you can also set the default profile name in `application.properties`, as shown in the following example:
368+
369+
[source,properties,indent=0,subs="verbatim,quotes,attributes",configprops]
370+
----
371+
spring.profiles.default=dev
372+
----
373+
374+
See "`<<spring-boot-features.adoc#boot-features-profiles>>`" in the "`Spring Boot features`" section for more information.
375+
376+
377+
362378
[[howto-change-configuration-depending-on-the-environment]]
363379
=== Change Configuration Depending on the Environment
364380
Spring Boot supports multi-document YAML and Properties files (see <<spring-boot-features#boot-features-external-config-files-multi-document>> for details) which can be activated conditionally based on the active profiles.

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,14 @@ For example, you could include it in your `application.properties`, as shown in
19061906

19071907
You could also specify it on the command line by using the following switch: `--spring.profiles.active=dev,hsqldb`.
19081908

1909+
If no profile is active, a default profile is enabled.
1910+
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:
1911+
1912+
[source,properties,indent=0,configprops]
1913+
----
1914+
spring.profiles.default=none
1915+
----
1916+
19091917

19101918

19111919
[[boot-features-adding-active-profiles]]

0 commit comments

Comments
 (0)