Class BeanValidationInterceptor<M extends Message>

java.lang.Object
org.axonframework.messaging.core.interception.BeanValidationInterceptor<M>
Type Parameters:
M - The message type this interceptor can process.
All Implemented Interfaces:
MessageDispatchInterceptor<M>, MessageHandlerInterceptor<M>

public class BeanValidationInterceptor<M extends Message> extends Object implements MessageHandlerInterceptor<M>, MessageDispatchInterceptor<M>
Interceptor that applies JSR303 bean validation on incoming Messages. When validation on a message fails, a JSR303ViolationException is thrown, holding the constraint violations. This interceptor can either be used as a MessageHandlerInterceptor or as a MessageDispatchInterceptor.
Since:
1.1.0
Author:
Allard Buijze
  • Constructor Details

    • BeanValidationInterceptor

      public BeanValidationInterceptor()
      Initializes a validation interceptor using a default ValidatorFactory.
      See Also:
      • Validation.buildDefaultValidatorFactory()
    • BeanValidationInterceptor

      public BeanValidationInterceptor(jakarta.validation.ValidatorFactory validatorFactory)
      Initializes a validation interceptor using the given ValidatorFactory.
      Parameters:
      validatorFactory - the factory providing Validator instances for this interceptor
  • Method Details