Class SpringBootstrap

  • Direct Known Subclasses:
    SharedDataSourceSpringBootstrap, SharedJtaSpringBootstrap

    public class SpringBootstrap
    extends org.springframework.boot.SpringApplication
    Base plugin ApplicationContext bootstrap class like SpringApplication to initialize environment in spring-boot style.
    • Constructor Summary

      Constructors 
      Constructor Description
      SpringBootstrap​(SpringBootPlugin plugin, java.lang.Class<?>... primarySources)
      Constructor should be the only thing need to take care for this Class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SpringBootstrap addPresetProperty​(java.lang.String name, java.lang.Object value)
      Properties that need to be set when this app is started as a plugin.
      protected void afterRefresh​(org.springframework.context.ConfigurableApplicationContext context, org.springframework.boot.ApplicationArguments args)  
      protected void bindToSpringApplication​(org.springframework.core.env.ConfigurableEnvironment environment)  
      protected void configurePropertySources​(org.springframework.core.env.ConfigurableEnvironment environment, java.lang.String[] args)  
      org.springframework.context.ConfigurableApplicationContext createApplicationContext()  
      protected java.lang.String[] getExcludeApplicationListeners()  
      protected java.lang.String[] getExcludeConfigurations()
      Override this methods to customize excluded spring boot configuration
      SpringBootstrap importBean​(java.lang.Class<?> beanClass)
      Beans that wanted to be shared from main ApplicationContext.
      SpringBootstrap importBean​(java.lang.String beanName)
      Beans that wanted to be shared from main ApplicationContext.
      protected boolean importBean​(org.springframework.context.support.GenericApplicationContext sourceApplicationContext, org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.Class<?> beanClass, boolean registerBeanDefinition)  
      protected boolean importBean​(org.springframework.context.support.GenericApplicationContext sourceApplicationContext, org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.String beanName, boolean registerBeanDefinition)  
      protected boolean importBeanFromDependentPlugin​(org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.Class<?> beanClass)  
      protected boolean importBeanFromDependentPlugin​(org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.String beanName)  
      protected boolean importBeanFromMainContext​(org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.Class<?> beanClass)  
      protected boolean importBeanFromMainContext​(org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.String beanName)  
      void setListeners​(java.util.Collection<? extends org.springframework.context.ApplicationListener<?>> listeners)  
      • Methods inherited from class org.springframework.boot.SpringApplication

        addBootstrapRegistryInitializer, addInitializers, addListeners, addPrimarySources, applyInitializers, configureEnvironment, configureProfiles, createBeanDefinitionLoader, exit, getAdditionalProfiles, getAllSources, getApplicationLog, getApplicationStartup, getClassLoader, getEnvironmentPrefix, getInitializers, getListeners, getMainApplicationClass, getResourceLoader, getShutdownHandlers, getSources, getWebApplicationType, load, logStartupInfo, logStartupProfileInfo, main, postProcessApplicationContext, refresh, registerLoggedException, run, run, run, setAddCommandLineProperties, setAddConversionService, setAdditionalProfiles, setAllowBeanDefinitionOverriding, setAllowCircularReferences, setApplicationContextFactory, setApplicationStartup, setBanner, setBannerMode, setBeanNameGenerator, setDefaultProperties, setDefaultProperties, setEnvironment, setEnvironmentPrefix, setHeadless, setInitializers, setLazyInitialization, setLogStartupInfo, setMainApplicationClass, setRegisterShutdownHook, setResourceLoader, setSources, setWebApplicationType
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BEAN_IMPORTED_BEAN_NAMES

        public static final java.lang.String BEAN_IMPORTED_BEAN_NAMES
        See Also:
        Constant Field Values
      • DEFAULT_EXCLUDE_CONFIGURATIONS

        public static final java.lang.String[] DEFAULT_EXCLUDE_CONFIGURATIONS
      • DEFAULT_EXCLUDE_APPLICATION_LISTENERS

        public static final java.lang.String[] DEFAULT_EXCLUDE_APPLICATION_LISTENERS
    • Constructor Detail

      • SpringBootstrap

        public SpringBootstrap​(SpringBootPlugin plugin,
                               java.lang.Class<?>... primarySources)
        Constructor should be the only thing need to take care for this Class. Generally new an instance and SpringApplication.run(String...) it in SpringBootPlugin.createSpringBootstrap() method.
        Parameters:
        primarySources - SpringApplication that annotated with @SpringBootApplication
    • Method Detail

      • importBean

        public SpringBootstrap importBean​(java.lang.String beanName)
        Beans that wanted to be shared from main ApplicationContext. Note that this method only takes effect before SpringApplication.run(String...) method.
      • importBean

        public SpringBootstrap importBean​(java.lang.Class<?> beanClass)
        Beans that wanted to be shared from main ApplicationContext. Note that this method only takes effect before SpringApplication.run(String...) method.
      • addPresetProperty

        public SpringBootstrap addPresetProperty​(java.lang.String name,
                                                 java.lang.Object value)
        Properties that need to be set when this app is started as a plugin. Note that this method only takes effect before SpringApplication.run(String...) method.
      • configurePropertySources

        protected void configurePropertySources​(org.springframework.core.env.ConfigurableEnvironment environment,
                                                java.lang.String[] args)
        Overrides:
        configurePropertySources in class org.springframework.boot.SpringApplication
      • bindToSpringApplication

        protected void bindToSpringApplication​(org.springframework.core.env.ConfigurableEnvironment environment)
        Overrides:
        bindToSpringApplication in class org.springframework.boot.SpringApplication
      • getExcludeConfigurations

        protected java.lang.String[] getExcludeConfigurations()
        Override this methods to customize excluded spring boot configuration
      • getExcludeApplicationListeners

        protected java.lang.String[] getExcludeApplicationListeners()
      • setListeners

        public void setListeners​(java.util.Collection<? extends org.springframework.context.ApplicationListener<?>> listeners)
        Overrides:
        setListeners in class org.springframework.boot.SpringApplication
      • createApplicationContext

        public org.springframework.context.ConfigurableApplicationContext createApplicationContext()
        Overrides:
        createApplicationContext in class org.springframework.boot.SpringApplication
      • afterRefresh

        protected void afterRefresh​(org.springframework.context.ConfigurableApplicationContext context,
                                    org.springframework.boot.ApplicationArguments args)
        Overrides:
        afterRefresh in class org.springframework.boot.SpringApplication
      • importBean

        protected boolean importBean​(org.springframework.context.support.GenericApplicationContext sourceApplicationContext,
                                     org.springframework.context.support.GenericApplicationContext applicationContext,
                                     java.lang.String beanName,
                                     boolean registerBeanDefinition)
      • importBean

        protected boolean importBean​(org.springframework.context.support.GenericApplicationContext sourceApplicationContext,
                                     org.springframework.context.support.GenericApplicationContext applicationContext,
                                     java.lang.Class<?> beanClass,
                                     boolean registerBeanDefinition)
      • importBeanFromMainContext

        protected boolean importBeanFromMainContext​(org.springframework.context.support.GenericApplicationContext applicationContext,
                                                    java.lang.String beanName)
      • importBeanFromMainContext

        protected boolean importBeanFromMainContext​(org.springframework.context.support.GenericApplicationContext applicationContext,
                                                    java.lang.Class<?> beanClass)
      • importBeanFromDependentPlugin

        protected boolean importBeanFromDependentPlugin​(org.springframework.context.support.GenericApplicationContext applicationContext,
                                                        java.lang.String beanName)
      • importBeanFromDependentPlugin

        protected boolean importBeanFromDependentPlugin​(org.springframework.context.support.GenericApplicationContext applicationContext,
                                                        java.lang.Class<?> beanClass)