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

Deprecation warning for composed Bean Validation constraint annotation #29206

Closed
Tristan971 opened this issue Sep 26, 2022 · 3 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@Tristan971
Copy link

Tristan971 commented Sep 26, 2022

Affects: Spring Framework v6.0.0-M6

Seeing these since Spring Boot 3.0-M4, and @wilkinsona suggested I open an issue for those here.

2022-09-26 15:32:23.243  WARN [                                main]   o.s.c.annotation.AnnotationTypeMapping : Support for convention-based annotation attribute overrides is deprecated and will be removed in Spring Framework 6.1. Please annotate the 'flags' attribute in @org.hibernate.validator.constraints.URL with an appropriate @AliasFor declaration -- for example, @AliasFor(annotation = jakarta.validation.constraints.Pattern.class).
2022-09-26 15:32:23.243  WARN [                                main]   o.s.c.annotation.AnnotationTypeMapping : Support for convention-based annotation attribute overrides is deprecated and will be removed in Spring Framework 6.1. Please annotate the 'groups' attribute in @org.hibernate.validator.constraints.URL with an appropriate @AliasFor declaration -- for example, @AliasFor(annotation = jakarta.validation.constraints.Pattern.class).
2022-09-26 15:32:23.243  WARN [                                main]   o.s.c.annotation.AnnotationTypeMapping : Support for convention-based annotation attribute overrides is deprecated and will be removed in Spring Framework 6.1. Please annotate the 'message' attribute in @org.hibernate.validator.constraints.URL with an appropriate @AliasFor declaration -- for example, @AliasFor(annotation = jakarta.validation.constraints.Pattern.class).
2022-09-26 15:32:23.243  WARN [                                main]   o.s.c.annotation.AnnotationTypeMapping : Support for convention-based annotation attribute overrides is deprecated and will be removed in Spring Framework 6.1. Please annotate the 'payload' attribute in @org.hibernate.validator.constraints.URL with an appropriate @AliasFor declaration -- for example, @AliasFor(annotation = jakarta.validation.constraints.Pattern.class).
2022-09-26 15:32:23.243  WARN [                                main]   o.s.c.annotation.AnnotationTypeMapping : Support for convention-based annotation attribute overrides is deprecated and will be removed in Spring Framework 6.1. Please annotate the 'regexp' attribute in @org.hibernate.validator.constraints.URL with an appropriate @AliasFor declaration -- for example, @AliasFor(annotation = jakarta.validation.constraints.Pattern.class).

Only affects @URL amongst those I use, so there could be more or it could be a one-off. Not certain.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 26, 2022
@sbrannen sbrannen self-assigned this Sep 26, 2022
@sbrannen sbrannen added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 26, 2022
@sbrannen sbrannen added this to the 6.0.0-RC1 milestone Sep 26, 2022
@sbrannen
Copy link
Member

Issuing a warning in scenarios that are completely unrelated to Spring was certainly unintentional, so thanks for raising the issue.

Generally speaking, any annotation meta-annotated with @jakarta.validation.Constraint (such as @org.hibernate.validator.constraints.URL) is participating in annotation semantics of the Java Bean Validation framework. So we could simply omit any custom validation constraint annotations from the warning, although there might be other use cases we should address.

We will investigate if we can improve this.

Related Issues:

@sbrannen sbrannen modified the milestones: 6.0.0-RC1, 6.0.0-RC2 Oct 5, 2022
@sbrannen sbrannen changed the title Deprecation warning with Hibernate Validator's @URL pattern annotation Deprecation warning for composed Bean Validation constraint annotation Oct 17, 2022
@sbrannen
Copy link
Member

This has been addressed in main.

Only affects @URL amongst those I use, so there could be more or it could be a one-off. Not certain.

It applied to Bean Validation @Constraint annotations that were meta-annotated with other @Constraint annotations. Hibernate's @URL annotation is meta-annotated with @Pattern, and the former overrides attributes in the latter.

@Tristan971
Copy link
Author

Makes sense, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants