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 newValidatingMongoEventListener
using the givenValidator
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
onBeforeSave
(BeforeSaveEvent<Object> event) Deprecated.CapturesBeforeSaveEvent
.Methods inherited from class org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener
onAfterConvert, onAfterDelete, onAfterLoad, onAfterSave, onApplicationEvent, onBeforeConvert, onBeforeDelete
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
ValidatingMongoEventListener
public ValidatingMongoEventListener(jakarta.validation.Validator validator) Deprecated.Creates a newValidatingMongoEventListener
using the givenValidator
.- Parameters:
validator
- must not be null.
-
-
Method Details
-
onBeforeSave
Deprecated.Description copied from class:AbstractMongoEventListener
CapturesBeforeSaveEvent
.- Overrides:
onBeforeSave
in classAbstractMongoEventListener<Object>
- Parameters:
event
- will never be null.
-
ValidatingEntityCallback
respectivelyReactiveValidatingEntityCallback
instead to ensure ordering and interruption of saving when encountering validation constraint violations.