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 |
environments(String... environments)
The environments to use.
|
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 . |
ApplicationContextBuilder singletons(Object... beans)
beans
- The beansApplicationContextBuilder environments(@Nullable String... environments)
environments
- The environmentsApplicationContextBuilder packages(@Nullable String... packages)
packages
- The packagesApplicationContextBuilder properties(@Nullable Map<String,Object> properties)
properties
- The propertiesApplicationContextBuilder propertySources(@Nullable PropertySource... propertySources)
propertySources
- The property sources to includeApplicationContextBuilder mainClass(Class mainClass)
mainClass
- The main classApplicationContextBuilder classLoader(ClassLoader classLoader)
classLoader
- The classloaderApplicationContext build()
ApplicationContext
, but does not start it.ApplicationContext
ApplicationContextBuilder include(@Nullable String... configurations)
configurations
- The configurations to includeApplicationContextBuilder exclude(@Nullable String... configurations)
configurations
- The configurations to excludedefault ApplicationContext start()
ApplicationContext
.ApplicationContext
default <T extends AutoCloseable> T run(Class<T> type)
ApplicationContext
with the given type. Returning an instance of the type.T
- The type, a subclass of ApplicationContextLifeCycle
type
- The type of the bean to run