Skip to content

Allow spring.profiles.active in a config file to take effect when spring.profiles.include is configured via a higher-precedence property source #15344

@facugaich

Description

@facugaich

Spring Boot version: 2.1.0.RELEASE

Summary: Setting spring.profiles.active in application.properties has no effect if system property spring.profiles.include or env var SPRING_PROFILES_INCLUDE is also set.

How to reproduce, using demo project from initializr:

application.properties
spring.profiles.active=active

Run with:
./mvnw -Dspring.profiles.include=include spring-boot:run

Expected:
The following profiles are active: include,active

But got:
The following profiles are active: include

I have also tested that the profile specific application-active.properties is not being loaded into the environment.

Setting active profiles in system properties seems to work:
./mvnw -Dspring.profiles.active=active -Dspring.profiles.include=include spring-boot:run

Output:
The following profiles are active: include,active

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions