Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ControllerAdviceBean javadoc is inconsistent with its implementation [SPR-13759] #18332

Closed
spring-projects-issues opened this issue Dec 4, 2015 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Andy Wilkinson opened SPR-13759 and commented

The javadoc states that:

The findAnnotatedBeans(ApplicationContext) method can be used to discover such beans. However, a ControllerAdviceBean may be created from any object, including ones without an @ControllerAdvice.

However, the implementation says otherwise:

ControllerAdvice annotation = AnnotationUtils.findAnnotation(beanType, ControllerAdvice.class);
if (annotation == null) {
     throw new IllegalArgumentException(
                   "Bean type [" + beanType.getName() + "] is not annotated as @ControllerAdvice");
}

Affects: 4.1.8, 4.2.3

Referenced from: commits d64ac32, 6963e27

Backported to: 4.1.9

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Andy Wilkinson, have you had a specific issue where you ran into this? Does the fix look alright, i.e. does a recent 4.2.4.BUILD-SNAPSHOT work for you there?

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Andy Wilkinson commented

Not personally, no. I was helping a Boot user who was looking for a way to use @ControllerAdvice without relying on component scanning which led to me noticing the inconsistency. Unfortunately, that means I don't have any code that I can try against the change. FWIW, on visual inspection, the change looks good to me.

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.2.4 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants