diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/external-config.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/external-config.adoc index f0f134cff954..f11a892801f3 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/external-config.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/external-config.adoc @@ -573,7 +573,9 @@ The following activation properties are available: | Property | Note | `on-profile` -| A profile expression that must match for the document to be active. +| A profile expression that must match for the document to be active, +or a list of profile expressions of which at least one must match for the document to be active. +Please note comma-separated list such as `foo,bar` is equal to `foo\|bar` instead of `foo&bar`. | `on-cloud-platform` | The javadoc:org.springframework.boot.cloud.CloudPlatform[] that must be detected for the document to be active. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataPropertiesTests.java index b3635903f2e2..d37b970d4d0a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -200,6 +200,17 @@ void isActiveAgainstBoundDataWhenCloudPlatformDoesntMatch() { assertThat(properties.isActive(context)).isFalse(); } + @Test + void isActiveAgainstBoundDataWhenProfilesMatchCommaSeparatedList() { + MapConfigurationPropertySource source = new MapConfigurationPropertySource(); + source.put("spring.config.activate.on-profile", "a&b,nonexistent"); + Binder binder = new Binder(source); + ConfigDataProperties properties = ConfigDataProperties.get(binder); + ConfigDataActivationContext context = new ConfigDataActivationContext(NULL_CLOUD_PLATFORM, + createTestProfiles()); + assertThat(properties.isActive(context)).isTrue(); + } + @Test void getImportOriginWhenCommaListReturnsOrigin() { MapConfigurationPropertySource source = new MapConfigurationPropertySource();