public interface ApplicationContextBuilder
Modifier and Type | Method and Description |
---|---|
default ApplicationContextBuilder |
args(String... args)
Set the command line arguments.
|
ApplicationContext |
build()
Builds the
ApplicationContext , but does not start it. |
ApplicationContextBuilder |
classLoader(ClassLoader classLoader)
The class loader to be used.
|
ApplicationContextBuilder |
deduceEnvironment(Boolean deduceEnvironment)
Whether to deduce environments.
|
ApplicationContextBuilder |
eagerInitAnnotated(Class<? extends Annotation>... annotations)
Specifies to eager init the given annotated types.
|
default ApplicationContextBuilder |
eagerInitConfiguration(boolean eagerInitConfiguration)
Whether to eager initialize
ConfigurationProperties beans. |
default ApplicationContextBuilder |
eagerInitSingletons(boolean eagerInitSingletons)
Whether to eager initialize singleton beans.
|
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.
|
ApplicationContextBuilder |
include(String... configurations)
Allow customizing the configurations that will be loaded.
|
ApplicationContextBuilder |
mainClass(Class mainClass)
The main class used by this application.
|
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.
|
default <T extends AutoCloseable> |
run(Class<T> type)
Run the
ApplicationContext with the given type. |
ApplicationContextBuilder |
singletons(Object... beans)
Additional singletons to register prior to startup.
|
default ApplicationContext |
start()
Starts the
ApplicationContext . |
@NonNull default ApplicationContextBuilder eagerInitConfiguration(boolean eagerInitConfiguration)
ConfigurationProperties
beans.eagerInitConfiguration
- True if configuration properties should be eagerly initialized@NonNull default ApplicationContextBuilder eagerInitSingletons(boolean eagerInitSingletons)
eagerInitSingletons
- True if singletons should be eagerly initialized@NonNull ApplicationContextBuilder eagerInitAnnotated(Class<? extends Annotation>... annotations)
annotations
- The annotation stereotypes@NonNull ApplicationContextBuilder overrideConfigLocations(String... configLocations)
configLocations
- The config locations@NonNull ApplicationContextBuilder singletons(@Nullable Object... beans)
beans
- The beans@NonNull ApplicationContextBuilder deduceEnvironment(@Nullable Boolean deduceEnvironment)
deduceEnvironment
- The boolean@NonNull ApplicationContextBuilder environments(@Nullable String... environments)
environments
- The environments@NonNull ApplicationContextBuilder packages(@Nullable String... packages)
packages
- The packages@NonNull ApplicationContextBuilder properties(@Nullable Map<String,Object> properties)
properties
- The properties@NonNull ApplicationContextBuilder propertySources(@Nullable PropertySource... propertySources)
propertySources
- The property sources to include@NonNull ApplicationContextBuilder environmentPropertySource(boolean environmentPropertySource)
environmentPropertySource
- The boolean@NonNull ApplicationContextBuilder environmentVariableIncludes(@Nullable String... environmentVariables)
environmentVariables
- The environment variables@NonNull ApplicationContextBuilder environmentVariableExcludes(@Nullable String... environmentVariables)
environmentVariables
- The environment variables@NonNull ApplicationContextBuilder mainClass(@Nullable Class mainClass)
mainClass
- The main class@NonNull ApplicationContextBuilder classLoader(@Nullable ClassLoader classLoader)
classLoader
- The classloader@NonNull ApplicationContext build()
ApplicationContext
, but does not start it.ApplicationContext
@NonNull ApplicationContextBuilder include(@Nullable String... configurations)
configurations
- The configurations to include@NonNull ApplicationContextBuilder exclude(@Nullable String... configurations)
configurations
- The configurations to exclude@NonNull default ApplicationContextBuilder args(@Nullable String... args)
args
- The arguments@NonNull default ApplicationContext start()
ApplicationContext
.ApplicationContext
@NonNull default <T extends AutoCloseable> T run(@NonNull Class<T> type)
ApplicationContext
with the given type. Returning an instance of the type.T
- The type, a subclass of AutoCloseable
. The close method of the implementation should shutdown the context.type
- The type of the bean to run