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 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 interface org.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 an AuditingHandler.
      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 a BeanDefinitionBuilder to ease the definition of store specific AuditingHandler 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 given BeanDefinitionBuilder with the default attributes from the given AuditingConfiguration.
      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 given AnnotationMetadata.
      Parameters:
      annotationMetadata - will never be null.
      Returns:
    • getAnnotation

      protected abstract Class<? extends Annotation> 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 the AuditingHandler.
      Parameters:
      auditingHandlerDefinition - will never be null.
      registry - will never be null.
    • getAuditingHandlerBeanName

      protected abstract String getAuditingHandlerBeanName()
      Return the name to be used to register the AuditingHandler under.
      Returns:
    • registerInfrastructureBeanWithId

      protected void registerInfrastructureBeanWithId(org.springframework.beans.factory.support.AbstractBeanDefinition definition, String id, org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
      Registers the given AbstractBeanDefinition 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.