Skip to content

Inconsistent configuration ordering with profiles #18199

Closed
@kzwang

Description

@kzwang

I have the following application.yml file:

---
spring:
  profiles: a & b
test1: 1
test2: 1

---
spring:
  profiles: a & b
test1: 2

---
spring:
  profiles: a & b & c
test2: 2

---
spring:
  profiles: a
test3: 1

---
spring:
  profiles: a
test3: 2

Based on documentation https://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html#howto-change-configuration-depending-on-the-environment, I would expect Later values override earlier values

I'm running the application with profile a, b, and c. However, I'm getting 2 for test3 (expected), but I'm getting 1 for both test1 and test2. So the ordering is opposite when spring.profiles contains a single profile vs an expression.

This works as expected if profiles are comma-separated, but not using profile expression.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions