Class JpaPooledDataSourceFactoryBeanRegistrar

java.lang.Object
com.broadleafcommerce.common.jpa.data.entitymanager.JpaPooledDataSourceFactoryBeanRegistrar
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.annotation.ImportBeanDefinitionRegistrar, org.springframework.context.EnvironmentAware

public class JpaPooledDataSourceFactoryBeanRegistrar extends Object implements org.springframework.context.annotation.ImportBeanDefinitionRegistrar, org.springframework.context.EnvironmentAware, org.springframework.beans.factory.BeanFactoryAware
Registers a pooling datasource bean definition. This definition represent the default behavior, unless spring.test.database.hsql is set to true (see JpaEmbeddedDataSourceFactoryBeanRegistrar). Successful configuration expects that a valid JpaPropertyRelated properties class is configured with the appropriate settings to connect to the backing datastore. This implementation assumes Hikari connection pool as the datasource pooling implementation. If a different pooling approach is desired, end implementations should explicitly declare a datasource with the bean id of JpaDataRoute.routeKey() appended by "DataSource". If a datasource with the bean id of JpaDataRoute.routeKey() appended by "DataSource" is present already, then this registrar is automatically skipped.
Author:
Jeff Fischer
  • Constructor Details

    • JpaPooledDataSourceFactoryBeanRegistrar

      public JpaPooledDataSourceFactoryBeanRegistrar()
  • Method Details

    • registerBeanDefinitions

      public void registerBeanDefinitions(org.springframework.core.type.AnnotationMetadata importingClassMetadata, org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
      Specified by:
      registerBeanDefinitions in interface org.springframework.context.annotation.ImportBeanDefinitionRegistrar
    • setEnvironment

      public void setEnvironment(org.springframework.core.env.Environment environment)
      Specified by:
      setEnvironment in interface org.springframework.context.EnvironmentAware
    • setBeanFactory

      public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
    • registerBean

      protected void registerBean(org.springframework.beans.factory.support.BeanDefinitionRegistry registry, Map<String,Object> attributes)
    • isHikariAvailable

      protected boolean isHikariAvailable()
    • resolvePlaceholders

      protected void resolvePlaceholders(DefaultDataRouteProperties delegateProperties)
      Resolve placeholders for targeted properties on DataRouteProperties.
      Parameters:
      delegateProperties - The properties holder with which to replace placeholders.