ControllerAdvice basePackages specifically refer to actual packages (avoiding accidental prefix matches with other packages)

Issue: SPR-12509
This commit is contained in:
Juergen Hoeller
2014-12-05 13:25:48 +01:00
parent 98870251f9
commit d1f8968595
3 changed files with 23 additions and 15 deletions

View File

@@ -102,12 +102,12 @@ public class ControllerAdviceBeanTests {
private void assertApplicable(String message, ControllerAdviceBean controllerAdvice, Class<?> controllerBeanType) {
assertNotNull(controllerAdvice);
assertTrue(message,controllerAdvice.isApplicableToBeanType(controllerBeanType));
assertTrue(message, controllerAdvice.isApplicableToBeanType(controllerBeanType));
}
private void assertNotApplicable(String message, ControllerAdviceBean controllerAdvice, Class<?> controllerBeanType) {
assertNotNull(controllerAdvice);
assertFalse(message,controllerAdvice.isApplicableToBeanType(controllerBeanType));
assertFalse(message, controllerAdvice.isApplicableToBeanType(controllerBeanType));
}
@@ -138,6 +138,7 @@ public class ControllerAdviceBeanTests {
@ControllerAdvice(basePackages = "java.util", annotations = {RestController.class})
static class ShouldNotMatch {}
// Support classes
static class MarkerClass {}