@FunctionalInterface public interface ApplicationContextFactory
ConfigurableApplicationContext
used by a
SpringApplication
. Created contexts should be returned in their default form,
with the SpringApplication
responsible for configuring and refreshing the
context.Modifier and Type | Field and Description |
---|---|
static ApplicationContextFactory |
DEFAULT
A default
ApplicationContextFactory implementation that will create an
appropriate context for the WebApplicationType . |
Modifier and Type | Method and Description |
---|---|
ConfigurableApplicationContext |
create(WebApplicationType webApplicationType)
|
static ApplicationContextFactory |
of(Supplier<ConfigurableApplicationContext> supplier)
Creates an
ApplicationContextFactory that will create contexts by calling
the given Supplier . |
static ApplicationContextFactory |
ofContextClass(Class<? extends ConfigurableApplicationContext> contextClass)
Creates an
ApplicationContextFactory that will create contexts by
instantiating the given contextClass via its primary constructor. |
static final ApplicationContextFactory DEFAULT
ApplicationContextFactory
implementation that will create an
appropriate context for the WebApplicationType
.ConfigurableApplicationContext create(WebApplicationType webApplicationType)
webApplicationType
- the web application typestatic ApplicationContextFactory ofContextClass(Class<? extends ConfigurableApplicationContext> contextClass)
ApplicationContextFactory
that will create contexts by
instantiating the given contextClass
via its primary constructor.contextClass
- the context classBeanUtils.instantiateClass(Class)
static ApplicationContextFactory of(Supplier<ConfigurableApplicationContext> supplier)
ApplicationContextFactory
that will create contexts by calling
the given Supplier
.supplier
- the context supplier, for example
AnnotationConfigApplicationContext::new