public class DefaultApplicationContextBuilder extends Object implements ApplicationContextBuilder, ApplicationContextConfiguration
ApplicationContextBuilder
.Modifier | Constructor and Description |
---|---|
protected |
DefaultApplicationContextBuilder()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
ApplicationContextBuilder |
allowEmptyProviders(boolean shouldAllow)
Whether to error on an empty bean provider.
|
ApplicationContextBuilder |
args(String... args)
Set the command line arguments.
|
ApplicationContextBuilder |
banner(boolean isEnabled)
Whether the banner is enabled or not.
|
ApplicationContextBuilder |
bootstrapEnvironment(boolean bootstrapEnv)
Sets whether the bootstrap environment should be initialized.
|
ApplicationContext |
build()
Builds the
ApplicationContext , but does not start it. |
ApplicationContextBuilder |
classLoader(ClassLoader classLoader)
The class loader to be used.
|
ApplicationContextBuilder |
deduceEnvironment(Boolean deduceEnvironments)
Whether to deduce environments.
|
ApplicationContextBuilder |
defaultEnvironments(String... environments)
The environments to use if no other environments are specified.
|
ApplicationContextBuilder |
eagerInitAnnotated(Class<? extends Annotation>... annotations)
Specifies to eager init the given annotated types.
|
ApplicationContextBuilder |
environmentPropertySource(boolean environmentPropertySource)
Set whether environment variables should contribute to configuration.
|
ApplicationContextBuilder |
environments(String... environments)
The environments to use.
|
ApplicationContextBuilder |
environmentVariableExcludes(String... environmentVariables)
Which environment variables should not contribute to configuration.
|
ApplicationContextBuilder |
environmentVariableIncludes(String... environmentVariables)
Which environment variables should contribute to configuration.
|
ApplicationContextBuilder |
exclude(String... configurations)
Allow customizing the configurations that will be loaded.
|
ClassLoader |
getClassLoader()
The class loader to use.
|
Optional<Boolean> |
getDeduceEnvironments() |
List<String> |
getDefaultEnvironments() |
Set<Class<? extends Annotation>> |
getEagerInitAnnotated() |
List<String> |
getEnvironments() |
List<String> |
getEnvironmentVariableExcludes() |
List<String> |
getEnvironmentVariableIncludes() |
List<String> |
getOverrideConfigLocations()
The config locations.
|
ClassPathResourceLoader |
getResourceLoader()
The class path resource loader to use.
|
ApplicationContextBuilder |
include(String... configurations)
Allow customizing the configurations that will be loaded.
|
boolean |
isAllowEmptyProviders() |
boolean |
isBannerEnabled()
The banner is enabled by default.
|
Boolean |
isBootstrapEnvironmentEnabled() |
boolean |
isEnvironmentPropertySource() |
ApplicationContextBuilder |
mainClass(Class mainClass)
The main class used by this application.
|
protected ApplicationContext |
newApplicationContext()
Creates the
ApplicationContext instance. |
ApplicationContextBuilder |
overrideConfigLocations(String... configLocations)
Override default config locations.
|
ApplicationContextBuilder |
packages(String... packages)
The packages to include for package scanning.
|
ApplicationContextBuilder |
properties(Map<String,Object> properties)
Properties to override from the environment.
|
ApplicationContextBuilder |
propertySources(PropertySource... propertySources)
Additional property sources.
|
ApplicationContextBuilder |
singletons(Object... beans)
Additional singletons to register prior to startup.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
eagerInitConfiguration, eagerInitSingletons, run, start
getConversionService
isEagerInitConfiguration, isEagerInitSingletons
protected DefaultApplicationContextBuilder()
public boolean isAllowEmptyProviders()
isAllowEmptyProviders
in interface BeanContextConfiguration
NoSuchBeanException
should be thrown on a missing BeanProvider
or Provider
@NonNull public ApplicationContextBuilder eagerInitAnnotated(Class<? extends Annotation>... annotations)
ApplicationContextBuilder
eagerInitAnnotated
in interface ApplicationContextBuilder
annotations
- The annotation stereotypes@NonNull public ApplicationContextBuilder overrideConfigLocations(String... configLocations)
ApplicationContextBuilder
overrideConfigLocations
in interface ApplicationContextBuilder
configLocations
- The config locations@Nullable public List<String> getOverrideConfigLocations()
ApplicationContextConfiguration
getOverrideConfigLocations
in interface ApplicationContextConfiguration
public boolean isBannerEnabled()
ApplicationContextConfiguration
isBannerEnabled
in interface ApplicationContextConfiguration
@Nullable public Boolean isBootstrapEnvironmentEnabled()
isBootstrapEnvironmentEnabled
in interface ApplicationContextConfiguration
public Set<Class<? extends Annotation>> getEagerInitAnnotated()
getEagerInitAnnotated
in interface BeanContextConfiguration
@NonNull public ApplicationContextBuilder singletons(Object... beans)
ApplicationContextBuilder
singletons
in interface ApplicationContextBuilder
beans
- The beans@NonNull public ClassPathResourceLoader getResourceLoader()
ApplicationContextConfiguration
getResourceLoader
in interface ApplicationContextConfiguration
@NonNull public ClassLoader getClassLoader()
BeanContextConfiguration
getClassLoader
in interface BeanContextConfiguration
@NonNull public ApplicationContextBuilder deduceEnvironment(@Nullable Boolean deduceEnvironments)
ApplicationContextBuilder
deduceEnvironment
in interface ApplicationContextBuilder
deduceEnvironments
- The boolean@NonNull public ApplicationContextBuilder environments(@Nullable String... environments)
ApplicationContextBuilder
environments
in interface ApplicationContextBuilder
environments
- The environments@NonNull public ApplicationContextBuilder defaultEnvironments(@Nullable String... environments)
ApplicationContextBuilder
defaultEnvironments
in interface ApplicationContextBuilder
environments
- The environments@NonNull public ApplicationContextBuilder packages(@Nullable String... packages)
ApplicationContextBuilder
packages
in interface ApplicationContextBuilder
packages
- The packages@NonNull public ApplicationContextBuilder properties(@Nullable Map<String,Object> properties)
ApplicationContextBuilder
properties
in interface ApplicationContextBuilder
properties
- The properties@NonNull public ApplicationContextBuilder propertySources(@Nullable PropertySource... propertySources)
ApplicationContextBuilder
propertySources
in interface ApplicationContextBuilder
propertySources
- The property sources to include@NonNull public ApplicationContextBuilder environmentPropertySource(boolean environmentPropertySource)
ApplicationContextBuilder
environmentPropertySource
in interface ApplicationContextBuilder
environmentPropertySource
- The boolean@NonNull public ApplicationContextBuilder environmentVariableIncludes(@Nullable String... environmentVariables)
ApplicationContextBuilder
environmentVariableIncludes
in interface ApplicationContextBuilder
environmentVariables
- The environment variables@NonNull public ApplicationContextBuilder environmentVariableExcludes(@Nullable String... environmentVariables)
ApplicationContextBuilder
environmentVariableExcludes
in interface ApplicationContextBuilder
environmentVariables
- The environment variablespublic Optional<Boolean> getDeduceEnvironments()
getDeduceEnvironments
in interface ApplicationContextConfiguration
@NonNull public List<String> getEnvironments()
getEnvironments
in interface ApplicationContextConfiguration
@NonNull public List<String> getDefaultEnvironments()
getDefaultEnvironments
in interface ApplicationContextConfiguration
public boolean isEnvironmentPropertySource()
isEnvironmentPropertySource
in interface ApplicationContextConfiguration
@Nullable public List<String> getEnvironmentVariableIncludes()
getEnvironmentVariableIncludes
in interface ApplicationContextConfiguration
@Nullable public List<String> getEnvironmentVariableExcludes()
getEnvironmentVariableExcludes
in interface ApplicationContextConfiguration
@NonNull public ApplicationContextBuilder mainClass(Class mainClass)
ApplicationContextBuilder
mainClass
in interface ApplicationContextBuilder
mainClass
- The main class@NonNull public ApplicationContextBuilder classLoader(ClassLoader classLoader)
ApplicationContextBuilder
classLoader
in interface ApplicationContextBuilder
classLoader
- The classloader@NonNull public ApplicationContextBuilder args(@Nullable String... args)
ApplicationContextBuilder
args
in interface ApplicationContextBuilder
args
- The arguments@NonNull public ApplicationContextBuilder bootstrapEnvironment(boolean bootstrapEnv)
ApplicationContextBuilder
bootstrapEnvironment
in interface ApplicationContextBuilder
bootstrapEnv
- True if it should be initialized. Default true@NonNull public ApplicationContext build()
ApplicationContextBuilder
ApplicationContext
, but does not start it.build
in interface ApplicationContextBuilder
ApplicationContext
@NonNull protected ApplicationContext newApplicationContext()
ApplicationContext
instance.@NonNull public ApplicationContextBuilder include(@Nullable String... configurations)
include
in interface ApplicationContextBuilder
configurations
- The configurations to include@NonNull public ApplicationContextBuilder exclude(@Nullable String... configurations)
exclude
in interface ApplicationContextBuilder
configurations
- The configurations to exclude@NonNull public ApplicationContextBuilder banner(boolean isEnabled)
ApplicationContextBuilder
banner
in interface ApplicationContextBuilder
isEnabled
- Whether the banner is enabled or not@NonNull public ApplicationContextBuilder allowEmptyProviders(boolean shouldAllow)
ApplicationContextBuilder
false
.allowEmptyProviders
in interface ApplicationContextBuilder
shouldAllow
- True if empty Provider
instances are allowed