public interface ApplicationContextBuilder
| Modifier and Type | Method and Description |
|---|---|
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 |
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 |
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 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 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