use of cn.taketoday.web.context.ConfigurableWebServletApplicationContext in project today-framework by TAKETODAY.
the class WebApplicationContextRunner method withMockServletContext.
/**
* Decorate the specified {@code contextFactory} to set a {@link MockServletContext}
* on each newly created {@link WebApplicationContext}.
*
* @param contextFactory the context factory to decorate
* @return an updated supplier that will set the {@link MockServletContext}
*/
public static Supplier<ConfigurableWebApplicationContext> withMockServletContext(Supplier<ConfigurableWebServletApplicationContext> contextFactory) {
return (contextFactory != null) ? () -> {
ConfigurableWebServletApplicationContext context = contextFactory.get();
context.setServletContext(new MockServletContext());
return context;
} : null;
}
use of cn.taketoday.web.context.ConfigurableWebServletApplicationContext in project today-infrastructure by TAKETODAY.
the class WebApplicationContextRunner method withMockServletContext.
/**
* Decorate the specified {@code contextFactory} to set a {@link MockServletContext}
* on each newly created {@link WebApplicationContext}.
*
* @param contextFactory the context factory to decorate
* @return an updated supplier that will set the {@link MockServletContext}
*/
public static Supplier<ConfigurableWebApplicationContext> withMockServletContext(Supplier<ConfigurableWebServletApplicationContext> contextFactory) {
return (contextFactory != null) ? () -> {
ConfigurableWebServletApplicationContext context = contextFactory.get();
context.setServletContext(new MockServletContext());
return context;
} : null;
}
Aggregations