You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Micronaut 4 should apply validation annotations even if class is in another module(jar).
Actual Behaviour
Hi
We tried to migrate Micronaut 3 project to Micronaut 4 however our tests started failing because validation stopped working.
After detailed investigation it turned out that Micronaut 4 doesn't apply validation annotation on the classes that come from another jar. For example:
@Getter
@Setter
public class Product {
@NotEmpty
@Size(
min = 3,
max = 16
)
private String name;
private int id;
}
We can't put @introspected annotation there so we use another approach:
@Introspected(classes = Product.class)
public class BeanValidationConfiguration {
}
We debugged this behavior to the method in AnnotationMetadataSupport:
It seems that REPEATABLE_ANNOTATIONS_CONTAINERS map contains only those annotations that are found inside current module.
So to workaround that we need to create dummy class and put there @notempty and @SiZe annotations.
Steps To Reproduce
No response
Environment Information
JDK 21
Example Application
No response
Version
4.1.4
The text was updated successfully, but these errors were encountered:
Expected Behavior
Micronaut 4 should apply validation annotations even if class is in another module(jar).
Actual Behaviour
Hi
We tried to migrate Micronaut 3 project to Micronaut 4 however our tests started failing because validation stopped working.
After detailed investigation it turned out that Micronaut 4 doesn't apply validation annotation on the classes that come from another jar. For example:
We can't put @introspected annotation there so we use another approach:
We debugged this behavior to the method in AnnotationMetadataSupport:
It seems that REPEATABLE_ANNOTATIONS_CONTAINERS map contains only those annotations that are found inside current module.
So to workaround that we need to create dummy class and put there @notempty and @SiZe annotations.
Steps To Reproduce
No response
Environment Information
JDK 21
Example Application
No response
Version
4.1.4
The text was updated successfully, but these errors were encountered: