Class ApplicationPostProcessor

  • All Implemented Interfaces:
    org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.core.Ordered

    public class ApplicationPostProcessor
    extends Object
    implements org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.core.Ordered
    A BeanFactoryPostProcessor that configures the datasource bean which is of type DataSource, but only if the Application requires a database.
    Additionally, the Site and the Application are also registered as beans.
    Author:
    Matthias Müller
    • Constructor Detail

      • ApplicationPostProcessor

        public ApplicationPostProcessor​(Site site,
                                        Application application,
                                        DatabaseConnection databaseConnection,
                                        org.springframework.cache.CacheManager platformCacheManager,
                                        Collection<String> dictionaryNames)
        Creates a new ApplicationPostProcessor using the given DatabaseConnection.
        Parameters:
        site - the Site
        application - the Application
        databaseConnection - a DatabaseConnection, may be null.
        platformCacheManager - the platform's CacheManager
        dictionaryNames - the name of the dictionary files that the Application uses (see AbstractResourceBasedMessageSource.setBasenames(String...))
    • Method Detail

      • postProcessBeanFactory

        public void postProcessBeanFactory​(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
                                    throws org.springframework.beans.BeansException
        If this ApplicationPostProcessor was created with a non-null DatabaseConnection, a DatasourceConfigurer is configured using that DatabaseConnection. Otherwise, the datasource bean gets destroyed.
        Specified by:
        postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
        Throws:
        org.springframework.beans.BeansException
        See Also:
        DatasourceConfigurer
      • getOrder

        public int getOrder()
        Specified by:
        getOrder in interface org.springframework.core.Ordered