Class AuditingHandler
java.lang.Object
org.springframework.data.auditing.AuditingHandlerSupport
org.springframework.data.auditing.AuditingHandler
- All Implemented Interfaces:
InitializingBean
- Direct Known Subclasses:
IsNewAwareAuditingHandler
Auditing handler to mark entity objects created and modified.
- Since:
- 1.5
- Author:
- Oliver Gierke, Christoph Strobl
-
Constructor Summary
ConstructorsConstructorDescriptionAuditingHandler(PersistentEntities entities) Creates a newAuditableBeanWrapperusing the givenPersistentEntitieswhen looking up auditing metadata via reflection. -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic AuditingHandlerfrom(MappingContext<?, ?> mappingContext) Factory method that creates a newAuditingHandlerfor the givenMappingContext.<T> TmarkCreated(T source) Marks the given object as created.<T> TmarkModified(T source) Marks the given object as modified.voidsetAuditorAware(AuditorAware<?> auditorAware) Setter to inject aAuditorAwarecomponent to retrieve the current auditor.Methods inherited from class org.springframework.data.auditing.AuditingHandlerSupport
isAuditable, setDateTimeForNow, setDateTimeProvider, setModifyOnCreation
-
Constructor Details
-
AuditingHandler
Creates a newAuditableBeanWrapperusing the givenPersistentEntitieswhen looking up auditing metadata via reflection.- Parameters:
entities- must not be null.- Since:
- 1.10
-
-
Method Details
-
from
Factory method that creates a newAuditingHandlerfor the givenMappingContext.- Parameters:
mappingContext- must not be null.- Since:
- 3.0
-
setAuditorAware
Setter to inject aAuditorAwarecomponent to retrieve the current auditor.- Parameters:
auditorAware- must not be null.
-
markCreated
public <T> T markCreated(T source) Marks the given object as created.- Parameters:
source-
-
markModified
public <T> T markModified(T source) Marks the given object as modified.- Parameters:
source-
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean
-