Module spring.data.mongodb
Class ValidatingMongoEventListener
java.lang.Object
org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener<Object>
org.springframework.data.mongodb.core.mapping.event.ValidatingMongoEventListener
- All Implemented Interfaces:
EventListener,ApplicationListener<MongoMappingEvent<?>>
javax.validation dependant entities validator. When it is registered as Spring component its automatically invoked
before entities are saved in database.
- Author:
- Maciej Walkowiak, Oliver Gierke, Christoph Strobl
-
Constructor Summary
ConstructorsConstructorDescriptionValidatingMongoEventListener(jakarta.validation.Validator validator) Creates a newValidatingMongoEventListenerusing the givenValidator. -
Method Summary
Modifier and TypeMethodDescriptionvoidonBeforeSave(BeforeSaveEvent<Object> event) CapturesBeforeSaveEvent.Methods inherited from class org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener
onAfterConvert, onAfterDelete, onAfterLoad, onAfterSave, onApplicationEvent, onBeforeConvert, onBeforeDeleteMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
ValidatingMongoEventListener
public ValidatingMongoEventListener(jakarta.validation.Validator validator) Creates a newValidatingMongoEventListenerusing the givenValidator.- Parameters:
validator- must not be null.
-
-
Method Details
-
onBeforeSave
Description copied from class:AbstractMongoEventListenerCapturesBeforeSaveEvent.- Overrides:
onBeforeSavein classAbstractMongoEventListener<Object>- Parameters:
event- will never be null.
-