Skip to content

Custom bean validation in a method #35738

Closed Answered by Eng-Fouad
Eng-Fouad asked this question in Q&A
Discussion options

You must be logged in to vote

I did it using ReaderInterceptor:

@Provider
public class ExtraValidationReaderInterceptor implements ReaderInterceptor {
    
    @Override
    public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException {
        var object = context.proceed();
        if (object instanceof ExtraValidation e) {
            e.validate();
        }
        return object;
    }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Eng-Fouad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant