Support commas in @ActiveProfiles
Update `SpringBootContextLoader` so that it correctly deals with an `@ActiveProfiles` annotation that contains a comma. Fixes gh-19537 Co-authored-by: Scott Frederick <sfrederick@pivotal.io> Co-authored-by: Andy Wilkinson <awilkinson@pivotal.io>
This commit is contained in:
@@ -153,8 +153,11 @@ public class SpringBootContextLoader extends AbstractContextLoader {
|
||||
}
|
||||
|
||||
private void setActiveProfiles(ConfigurableEnvironment environment, String[] profiles) {
|
||||
TestPropertyValues.of("spring.profiles.active=" + StringUtils.arrayToCommaDelimitedString(profiles))
|
||||
.applyTo(environment);
|
||||
String[] pairs = new String[profiles.length];
|
||||
for (int i = 0; i < profiles.length; i++) {
|
||||
pairs[i] = "spring.profiles.active[" + i + "]=" + profiles[i];
|
||||
}
|
||||
TestPropertyValues.of(pairs).applyTo(environment);
|
||||
}
|
||||
|
||||
protected String[] getInlinedProperties(MergedContextConfiguration config) {
|
||||
|
||||
Reference in New Issue
Block a user