Fix spring.application.exclude YAML property
`spring.application.exclude` is retrieved via the `RelaxedPropertyResolver` API explicitly and it does not have any standard API to retrieve a list of values. As a consequence that property could only be specified as a comma-separated value. This felt convoluted in YAML. `RelaxedPropertyResolver` has now a `getProperties` method that works with both comma-separated value and index elements (i.e. list). Closes gh-4352
This commit is contained in:
@@ -134,6 +134,21 @@ public class EnableAutoConfigurationImportSelectorTests {
|
||||
VelocityAutoConfiguration.class.getName()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void severalPropertyYamlExclusionsAreApplied() {
|
||||
configureExclusions(new String[0], new String[0], new String[0]);
|
||||
this.environment.setProperty("spring.autoconfigure.exclude[0]",
|
||||
FreeMarkerAutoConfiguration.class.getName());
|
||||
this.environment.setProperty("spring.autoconfigure.exclude[1]",
|
||||
VelocityAutoConfiguration.class.getName());
|
||||
String[] imports = this.importSelector.selectImports(this.annotationMetadata);
|
||||
assertThat(imports.length,
|
||||
is(equalTo(getAutoConfigurationClassNames().size() - 2)));
|
||||
assertThat(ConditionEvaluationReport.get(this.beanFactory).getExclusions(),
|
||||
containsInAnyOrder(FreeMarkerAutoConfiguration.class.getName(),
|
||||
VelocityAutoConfiguration.class.getName()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void combinedExclusionsAreApplied() {
|
||||
configureExclusions(new String[] { VelocityAutoConfiguration.class.getName() },
|
||||
|
||||
Reference in New Issue
Block a user