spring.profiles.active
can be used to specify which profiles are always active.
An example from the documentation:
spring:
profiles:
active: "production"
spring.config.activate.on-profile
(known as spring.profiles
before Spring Boot 2.4) can be used to mark a configuration file segment profile-specific.
An example from the documentation:
server:
port: 9000
---
spring:
config:
activate:
on-profile: "development"
server:
port: 9001
---
spring:
config:
activate:
on-profile: "production"
server:
port: 0
In the preceding example, the default port is 9000. However, if the Spring profile called ‘development’ is active, then the port is 9001. If ‘production’ is active, then the port is 0.
Another change in Spring Boot 2.4 was that the spring.profiles.active
property is no longer allowed in combination with spring.config.activate.on-profile
. (See this blog post for details.)