Skip to content

Commit 3fbf5ee

Browse files
committed
Document spring.profiles.default in the reference guide
Closes gh-26592
1 parent 39e3746 commit 3fbf5ee

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
@@ -349,6 +349,22 @@ See "`<<spring-boot-features.adoc#boot-features-profiles>>`" in the "`Spring Boo
349349

350350

351351

352+
[[howto-set-default-spring-profile-name]]
353+
=== Set the Default Profile Name
354+
The default profile is a profile that is enabled if no profile is active.
355+
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]).
356+
357+
In Spring Boot, you can also set the default profile name in `application.properties`, as shown in the following example:
358+
359+
[source,properties,indent=0,subs="verbatim,quotes,attributes",configprops]
360+
----
361+
spring.profiles.default=dev
362+
----
363+
364+
See "`<<spring-boot-features.adoc#boot-features-profiles>>`" in the "`Spring Boot features`" section for more information.
365+
366+
367+
352368
[[howto-change-configuration-depending-on-the-environment]]
353369
=== Change Configuration Depending on the Environment
354370
A YAML file is actually a sequence of documents separated by `---` lines, and each document is parsed separately to a flattened map.

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
@@ -1667,6 +1667,14 @@ For example, you could include it in your `application.properties`, as shown in
16671667

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

1670+
If no profile is active, a default profile is enabled.
1671+
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:
1672+
1673+
[source,properties,indent=0,configprops]
1674+
----
1675+
spring.profiles.default=none
1676+
----
1677+
16701678

16711679

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

0 commit comments

Comments
 (0)