Package org.laxture.sbp.spring.boot
Class SpringBootstrap
- java.lang.Object
-
- org.springframework.boot.SpringApplication
-
- org.laxture.sbp.spring.boot.SpringBootstrap
-
- Direct Known Subclasses:
SharedDataSourceSpringBootstrap,SharedJtaSpringBootstrap
public class SpringBootstrap extends org.springframework.boot.SpringApplicationBase pluginApplicationContextbootstrap class likeSpringApplicationto initialize environment in spring-boot style.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classSpringBootstrap.ExcludeConfigurations
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBEAN_IMPORTED_BEAN_NAMESstatic java.lang.StringBEAN_PLUGINstatic java.lang.String[]DEFAULT_EXCLUDE_APPLICATION_LISTENERSstatic java.lang.String[]DEFAULT_EXCLUDE_CONFIGURATIONS
-
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 SpringBootstrapaddPresetProperty(java.lang.String name, java.lang.Object value)Properties that need to be set when this app is started as a plugin.protected voidafterRefresh(org.springframework.context.ConfigurableApplicationContext context, org.springframework.boot.ApplicationArguments args)protected voidbindToSpringApplication(org.springframework.core.env.ConfigurableEnvironment environment)protected voidconfigurePropertySources(org.springframework.core.env.ConfigurableEnvironment environment, java.lang.String[] args)org.springframework.context.ConfigurableApplicationContextcreateApplicationContext()protected java.lang.String[]getExcludeApplicationListeners()protected java.lang.String[]getExcludeConfigurations()Override this methods to customize excluded spring boot configurationSpringBootstrapimportBean(java.lang.Class<?> beanClass)Beans that wanted to be shared from mainApplicationContext.SpringBootstrapimportBean(java.lang.String beanName)Beans that wanted to be shared from mainApplicationContext.protected booleanimportBean(org.springframework.context.support.GenericApplicationContext sourceApplicationContext, org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.Class<?> beanClass, boolean registerBeanDefinition)protected booleanimportBean(org.springframework.context.support.GenericApplicationContext sourceApplicationContext, org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.String beanName, boolean registerBeanDefinition)protected booleanimportBeanFromDependentPlugin(org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.Class<?> beanClass)protected booleanimportBeanFromDependentPlugin(org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.String beanName)protected booleanimportBeanFromMainContext(org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.Class<?> beanClass)protected booleanimportBeanFromMainContext(org.springframework.context.support.GenericApplicationContext applicationContext, java.lang.String beanName)voidsetListeners(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
-
-
-
-
Field Detail
-
BEAN_PLUGIN
public static final java.lang.String BEAN_PLUGIN
- See Also:
- Constant Field Values
-
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 andSpringApplication.run(String...)it inSpringBootPlugin.createSpringBootstrap()method.- Parameters:
primarySources-SpringApplicationthat annotated with @SpringBootApplication
-
-
Method Detail
-
importBean
public SpringBootstrap importBean(java.lang.String beanName)
Beans that wanted to be shared from mainApplicationContext. Note that this method only takes effect beforeSpringApplication.run(String...)method.
-
importBean
public SpringBootstrap importBean(java.lang.Class<?> beanClass)
Beans that wanted to be shared from mainApplicationContext. Note that this method only takes effect beforeSpringApplication.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 beforeSpringApplication.run(String...)method.
-
configurePropertySources
protected void configurePropertySources(org.springframework.core.env.ConfigurableEnvironment environment, java.lang.String[] args)- Overrides:
configurePropertySourcesin classorg.springframework.boot.SpringApplication
-
bindToSpringApplication
protected void bindToSpringApplication(org.springframework.core.env.ConfigurableEnvironment environment)
- Overrides:
bindToSpringApplicationin classorg.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:
setListenersin classorg.springframework.boot.SpringApplication
-
createApplicationContext
public org.springframework.context.ConfigurableApplicationContext createApplicationContext()
- Overrides:
createApplicationContextin classorg.springframework.boot.SpringApplication
-
afterRefresh
protected void afterRefresh(org.springframework.context.ConfigurableApplicationContext context, org.springframework.boot.ApplicationArguments args)- Overrides:
afterRefreshin classorg.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)
-
-