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<?>>
@Deprecated(since="4.5")
public class ValidatingMongoEventListener
extends AbstractMongoEventListener<Object>
Deprecated.
JSR-303 dependant entities validator.
When it is registered as Spring component its automatically invoked after object to Document conversion and
before entities are saved to the database.
- Author:
- Maciej Walkowiak, Oliver Gierke, Christoph Strobl
-
Constructor Summary
ConstructorsConstructorDescriptionValidatingMongoEventListener(jakarta.validation.Validator validator) Deprecated.Creates a newValidatingMongoEventListenerusing the givenValidator. -
Method Summary
Modifier and TypeMethodDescriptionvoidonBeforeSave(BeforeSaveEvent<Object> event) Deprecated.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) Deprecated.Creates a newValidatingMongoEventListenerusing the givenValidator.- Parameters:
validator- must not be null.
-
-
Method Details
-
onBeforeSave
Deprecated.Description copied from class:AbstractMongoEventListenerCapturesBeforeSaveEvent.- Overrides:
onBeforeSavein classAbstractMongoEventListener<Object>- Parameters:
event- will never be null.
-
ValidatingEntityCallbackrespectivelyReactiveValidatingEntityCallbackinstead to ensure ordering and interruption of saving when encountering validation constraint violations.