Class AuditingHandler
java.lang.Object
org.springframework.data.auditing.AuditingHandlerSupport
org.springframework.data.auditing.AuditingHandler
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
IsNewAwareAuditingHandler
public class AuditingHandler
extends AuditingHandlerSupport
implements org.springframework.beans.factory.InitializingBean
Auditing handler to mark entity objects created and modified.
- Since:
- 1.5
- Author:
- Oliver Gierke, Christoph Strobl
-
Constructor Summary
ConstructorDescriptionAuditingHandler
(PersistentEntities entities) Creates a newAuditableBeanWrapper
using the givenPersistentEntities
when looking up auditing metadata via reflection. -
Method Summary
Modifier and TypeMethodDescriptionvoid
static AuditingHandler
from
(MappingContext<?, ?> mappingContext) Factory method that creates a newAuditingHandler
for the givenMappingContext
.<T> T
markCreated
(T source) Marks the given object as created.<T> T
markModified
(T source) Marks the given object as modified.void
setAuditorAware
(AuditorAware<?> auditorAware) Setter to inject aAuditorAware
component to retrieve the current auditor.Methods inherited from class org.springframework.data.auditing.AuditingHandlerSupport
isAuditable, setDateTimeForNow, setDateTimeProvider, setModifyOnCreation
-
Constructor Details
-
AuditingHandler
Creates a newAuditableBeanWrapper
using the givenPersistentEntities
when looking up auditing metadata via reflection.- Parameters:
entities
- must not be null.- Since:
- 1.10
-
-
Method Details
-
from
Factory method that creates a newAuditingHandler
for the givenMappingContext
.- Parameters:
mappingContext
- must not be null.- Since:
- 3.0
-
setAuditorAware
Setter to inject aAuditorAware
component 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:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-