|
|
@ -84,6 +84,18 @@ public class ServletComponentScanRegistrarTests {
|
|
|
|
.getPackage().getName()));
|
|
|
|
.getPackage().getName()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void packagesFromMultipleAnnotationsAreMerged() {
|
|
|
|
|
|
|
|
this.context = new AnnotationConfigApplicationContext(BasePackages.class,
|
|
|
|
|
|
|
|
AdditionalPackages.class);
|
|
|
|
|
|
|
|
ServletComponentRegisteringPostProcessor postProcessor = this.context
|
|
|
|
|
|
|
|
.getBean(ServletComponentRegisteringPostProcessor.class);
|
|
|
|
|
|
|
|
assertThat(
|
|
|
|
|
|
|
|
postProcessor.getPackagesToScan(),
|
|
|
|
|
|
|
|
containsInAnyOrder("com.example.foo", "com.example.bar",
|
|
|
|
|
|
|
|
"com.example.baz"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
@ServletComponentScan({ "com.example.foo", "com.example.bar" })
|
|
|
|
@ServletComponentScan({ "com.example.foo", "com.example.bar" })
|
|
|
|
static class ValuePackages {
|
|
|
|
static class ValuePackages {
|
|
|
@ -96,6 +108,12 @@ public class ServletComponentScanRegistrarTests {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
|
|
|
@ServletComponentScan(basePackages = "com.example.baz")
|
|
|
|
|
|
|
|
static class AdditionalPackages {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
@ServletComponentScan(basePackageClasses = ServletComponentScanRegistrarTests.class)
|
|
|
|
@ServletComponentScan(basePackageClasses = ServletComponentScanRegistrarTests.class)
|
|
|
|
static class BasePackageClasses {
|
|
|
|
static class BasePackageClasses {
|
|
|
|