Class AuditingBeanDefinitionRegistrarSupport
java.lang.Object
org.springframework.data.auditing.config.AuditingBeanDefinitionRegistrarSupport
- All Implemented Interfaces:
org.springframework.context.annotation.ImportBeanDefinitionRegistrar
public abstract class AuditingBeanDefinitionRegistrarSupport
extends Object
implements org.springframework.context.annotation.ImportBeanDefinitionRegistrar
A
ImportBeanDefinitionRegistrar
that serves as a base class for store specific implementations for
configuring audit support. Registers a AuditingHandler
based on the provided configuration(
AuditingConfiguration
).- Author:
- Ranie Jade Ramiso, Thomas Darimont, Oliver Gierke, Francisco Soler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.beans.factory.support.BeanDefinitionBuilder
configureDefaultAuditHandlerAttributes
(AuditingConfiguration configuration, org.springframework.beans.factory.support.BeanDefinitionBuilder builder) Configures the givenBeanDefinitionBuilder
with the default attributes from the givenAuditingConfiguration
.protected abstract Class<? extends Annotation>
Return the annotation type to lookup configuration values from.protected org.springframework.beans.factory.support.BeanDefinitionBuilder
getAuditHandlerBeanDefinitionBuilder
(AuditingConfiguration configuration) Creates aBeanDefinitionBuilder
to ease the definition of store specificAuditingHandler
implementations.protected abstract String
Return the name to be used to register theAuditingHandler
under.protected AuditingConfiguration
getConfiguration
(org.springframework.core.type.AnnotationMetadata annotationMetadata) Retrieve auditing configuration from the givenAnnotationMetadata
.protected void
postProcess
(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, AuditingConfiguration configuration, org.springframework.beans.factory.support.BeanDefinitionRegistry registry) Customization hook to post-process the AuditHandler BeanDefinition.protected org.springframework.beans.factory.support.AbstractBeanDefinition
registerAuditHandlerBeanDefinition
(AuditingConfiguration configuration, org.springframework.beans.factory.support.BeanDefinitionRegistry registry) Registers an appropriate BeanDefinition for anAuditingHandler
.protected abstract void
registerAuditListenerBeanDefinition
(org.springframework.beans.factory.config.BeanDefinition auditingHandlerDefinition, org.springframework.beans.factory.support.BeanDefinitionRegistry registry) Register the listener to eventually trigger theAuditingHandler
.void
registerBeanDefinitions
(org.springframework.core.type.AnnotationMetadata annotationMetadata, org.springframework.beans.factory.support.BeanDefinitionRegistry registry) protected void
registerInfrastructureBeanWithId
(org.springframework.beans.factory.support.AbstractBeanDefinition definition, String id, org.springframework.beans.factory.support.BeanDefinitionRegistry registry) Registers the givenAbstractBeanDefinition
as infrastructure bean under the given id.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.annotation.ImportBeanDefinitionRegistrar
registerBeanDefinitions
-
Constructor Details
-
AuditingBeanDefinitionRegistrarSupport
public AuditingBeanDefinitionRegistrarSupport()
-
-
Method Details
-
registerBeanDefinitions
public void registerBeanDefinitions(org.springframework.core.type.AnnotationMetadata annotationMetadata, org.springframework.beans.factory.support.BeanDefinitionRegistry registry) - Specified by:
registerBeanDefinitions
in interfaceorg.springframework.context.annotation.ImportBeanDefinitionRegistrar
-
registerAuditHandlerBeanDefinition
protected org.springframework.beans.factory.support.AbstractBeanDefinition registerAuditHandlerBeanDefinition(AuditingConfiguration configuration, org.springframework.beans.factory.support.BeanDefinitionRegistry registry) Registers an appropriate BeanDefinition for anAuditingHandler
.- Parameters:
configuration
- must not be null.registry
- must not be null.- Returns:
-
postProcess
protected void postProcess(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, AuditingConfiguration configuration, org.springframework.beans.factory.support.BeanDefinitionRegistry registry) Customization hook to post-process the AuditHandler BeanDefinition.- Parameters:
builder
- must not be null.registry
- must not be null.configuration
- must not be null.- Since:
- 3.0
-
getAuditHandlerBeanDefinitionBuilder
protected org.springframework.beans.factory.support.BeanDefinitionBuilder getAuditHandlerBeanDefinitionBuilder(AuditingConfiguration configuration) Creates aBeanDefinitionBuilder
to ease the definition of store specificAuditingHandler
implementations.- Parameters:
configuration
- must not be null.- Returns:
-
configureDefaultAuditHandlerAttributes
protected org.springframework.beans.factory.support.BeanDefinitionBuilder configureDefaultAuditHandlerAttributes(AuditingConfiguration configuration, org.springframework.beans.factory.support.BeanDefinitionBuilder builder) Configures the givenBeanDefinitionBuilder
with the default attributes from the givenAuditingConfiguration
.- Parameters:
configuration
- must not be null.builder
- must not be null.- Returns:
- the builder with the audit attributes configured.
-
getConfiguration
protected AuditingConfiguration getConfiguration(org.springframework.core.type.AnnotationMetadata annotationMetadata) Retrieve auditing configuration from the givenAnnotationMetadata
.- Parameters:
annotationMetadata
- will never be null.- Returns:
-
getAnnotation
Return the annotation type to lookup configuration values from.- Returns:
- must not be null.
-
registerAuditListenerBeanDefinition
protected abstract void registerAuditListenerBeanDefinition(org.springframework.beans.factory.config.BeanDefinition auditingHandlerDefinition, org.springframework.beans.factory.support.BeanDefinitionRegistry registry) Register the listener to eventually trigger theAuditingHandler
.- Parameters:
auditingHandlerDefinition
- will never be null.registry
- will never be null.
-
getAuditingHandlerBeanName
Return the name to be used to register theAuditingHandler
under.- Returns:
-
registerInfrastructureBeanWithId
protected void registerInfrastructureBeanWithId(org.springframework.beans.factory.support.AbstractBeanDefinition definition, String id, org.springframework.beans.factory.support.BeanDefinitionRegistry registry) Registers the givenAbstractBeanDefinition
as infrastructure bean under the given id.- Parameters:
definition
- must not be null.id
- must not be null or empty.registry
- must not be null.
-