Skip to content

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

Closed
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions