Skip to content

Commit bd709f3

Browse files
eddumelendezphilwebb
authored andcommitted
Fix springProfile with multi profiles separated by comma and whitespace
Previously springProfile supported multi profiles separated by comma but it doesn´t work if there are whitespaces. Now, springProfile will read values cleaning whitespaces. See gh-4445
1 parent 6a32955 commit bd709f3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-boot/src/main/java/org/springframework/boot/logging/logback/SpringProfileAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public void begin(InterpretationContext ic, String name, Attributes attributes)
6767
}
6868

6969
private boolean acceptsProfiles(InterpretationContext ic, Attributes attributes) {
70-
String[] profileNames = StringUtils
71-
.commaDelimitedListToStringArray(attributes.getValue(NAME_ATTRIBUTE));
70+
String[] profileNames = StringUtils.trimArrayElements(StringUtils
71+
.commaDelimitedListToStringArray(attributes.getValue(NAME_ATTRIBUTE)));
7272
if (profileNames.length != 0) {
7373
for (String profileName : profileNames) {
7474
OptionHelper.substVars(profileName, ic, this.context);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<configuration>
33
<include resource="org/springframework/boot/logging/logback/base.xml" />
4-
<springProfile name="production,test">
4+
<springProfile name="production, test">
55
<logger name="org.springframework.boot.logging.logback" level="TRACE" />
66
</springProfile>
77
</configuration>

0 commit comments

Comments
 (0)