@@ -380,10 +380,13 @@ environment variables or system properties.
380
380
[[boot-features-external-config-profile-specific-properties]]
381
381
=== Profile-specific properties
382
382
In addition to `application.properties` files, profile-specific properties can also be
383
- defined using the naming convention `application-{profile}.properties`.
383
+ defined using the naming convention `application-{profile}.properties`. The
384
+ `Environment` has a set of default profiles (by default `[default]`) which are
385
+ used if no active profiels are set (i.e. if no profiles are explicitly activated
386
+ then properties from `application-default.properties` are loaded).
384
387
385
388
Profile specific properties are loaded from the same locations as standard
386
- `application.properties`, with profile-specific files always overriding the default
389
+ `application.properties`, with profile-specific files always overriding the non-specific
387
390
ones irrespective of whether the profile-specific files are inside or outside your
388
391
packaged jar.
389
392
@@ -518,8 +521,35 @@ using a `spring.profiles` key to indicate when the document applies. For example
518
521
519
522
In the example above, the `server.address` property will be `127.0.0.1` if the
520
523
`development` profile is active. If the `development` and `production` profiles are *not*
521
- enabled, then the value for the property will be `192.168.1.100`
524
+ enabled, then the value for the property will be `192.168.1.100`.
522
525
526
+ The default profiles are activated if none are explicitly active when the application
527
+ context starts. So in this YAML we set a value for `security.user.password` that is
528
+ *only* available in the "default" profile:
529
+
530
+ [source,yaml,indent=0]
531
+ ----
532
+ server:
533
+ port: 80000
534
+ ---
535
+ spring:
536
+ profiles: default
537
+ security:
538
+ user:
539
+ password: weak
540
+ ----
541
+
542
+ whereas in this example, the password is always set because it isn't attached to any profile,
543
+ and it would have to be explicitly reset in all other profiles as necessary:
544
+
545
+ [source,yaml,indent=0]
546
+ ----
547
+ server:
548
+ port: 80000
549
+ security:
550
+ user:
551
+ password: weak
552
+ ----
523
553
524
554
525
555
[[boot-features-external-config-yaml-shortcomings]]
0 commit comments