Class SpringBootstrap

java.lang.Object
org.springframework.boot.SpringApplication
org.laxture.sbp.spring.boot.SpringBootstrap

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

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
     

    Nested classes/interfaces inherited from class org.springframework.boot.SpringApplication

    org.springframework.boot.SpringApplication.AbandonedRunException, org.springframework.boot.SpringApplication.Augmented, org.springframework.boot.SpringApplication.Running
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String[]
     
    static final String[]
     

    Fields inherited from class org.springframework.boot.SpringApplication

    BANNER_LOCATION_PROPERTY, BANNER_LOCATION_PROPERTY_VALUE
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    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, String[] args)
     
    org.springframework.context.ConfigurableApplicationContext
     
    protected String[]
     
    org.springframework.context.support.GenericApplicationContext
     
    importBean(Class<?> beanClass)
    Beans that wanted to be shared from main ApplicationContext.
    importBean(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, Class<?> beanClass)
     
    protected boolean
    importBean(org.springframework.context.support.GenericApplicationContext sourceApplicationContext, org.springframework.context.support.GenericApplicationContext applicationContext, String beanName)
     
    boolean
    importBeanFromDependentPlugin(org.springframework.context.support.GenericApplicationContext applicationContext, Class<?> beanClass)
     
    boolean
    importBeanFromDependentPlugin(org.springframework.context.support.GenericApplicationContext applicationContext, String beanName)
     
    boolean
    importBeanFromMainContext(org.springframework.context.support.GenericApplicationContext applicationContext, Class<?> beanClass)
     
    boolean
    importBeanFromMainContext(org.springframework.context.support.GenericApplicationContext applicationContext, String beanName)
     
    void
    setListeners(Collection<? extends org.springframework.context.ApplicationListener<?>> listeners)
     

    Methods inherited from class org.springframework.boot.SpringApplication

    addBootstrapRegistryInitializer, addInitializers, addListeners, addPrimarySources, applyInitializers, configureEnvironment, configureProfiles, createBeanDefinitionLoader, exit, from, getAdditionalProfiles, getAllSources, getApplicationLog, getApplicationStartup, getClassLoader, getEnvironmentPrefix, getInitializers, getListeners, getMainApplicationClass, getResourceLoader, getShutdownHandlers, getSources, getWebApplicationType, isKeepAlive, 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, setKeepAlive, setLazyInitialization, setLogStartupInfo, setMainApplicationClass, setRegisterShutdownHook, setResourceLoader, setSources, setWebApplicationType, withHook, withHook

    Methods inherited from class java.lang.Object

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

    • BEAN_PLUGIN

      public static final String BEAN_PLUGIN
      See Also:
    • BEAN_IMPORTED_BEAN_NAMES

      public static final String BEAN_IMPORTED_BEAN_NAMES
      See Also:
    • DEFAULT_EXCLUDE_CONFIGURATIONS

      public static final String[] DEFAULT_EXCLUDE_CONFIGURATIONS
    • DEFAULT_EXCLUDE_APPLICATION_LISTENERS

      public static final String[] DEFAULT_EXCLUDE_APPLICATION_LISTENERS
  • Constructor Details

    • SpringBootstrap

      public SpringBootstrap(SpringBootPlugin plugin, 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 Details

    • getMainApplicationContext

      public org.springframework.context.support.GenericApplicationContext getMainApplicationContext()
    • importBean

      public SpringBootstrap importBean(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(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(String name, 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, 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
    • getExcludeApplicationListeners

      protected String[] getExcludeApplicationListeners()
    • setListeners

      public void setListeners(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, String beanName)
    • importBean

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

      public boolean importBeanFromMainContext(org.springframework.context.support.GenericApplicationContext applicationContext, String beanName)
    • importBeanFromMainContext

      public boolean importBeanFromMainContext(org.springframework.context.support.GenericApplicationContext applicationContext, Class<?> beanClass)
    • importBeanFromDependentPlugin

      public boolean importBeanFromDependentPlugin(org.springframework.context.support.GenericApplicationContext applicationContext, String beanName)
    • importBeanFromDependentPlugin

      public boolean importBeanFromDependentPlugin(org.springframework.context.support.GenericApplicationContext applicationContext, Class<?> beanClass)