接口 ApplicationContextAssertProvider<C extends ApplicationContext>
- 类型参数:
C- the application context type
- 所有超级接口:
ApplicationContext,ApplicationEventPublisher,org.assertj.core.api.AssertProvider<ApplicationContextAssert<C>>,AutoCloseable,BeanFactory,Closeable,EnvironmentCapable,HierarchicalBeanFactory,ListableBeanFactory,MessageSource,ResourceLoader,ResourcePatternResolver
- 所有已知子接口:
AssertableApplicationContext,AssertableReactiveWebApplicationContext,AssertableWebApplicationContext
public interface ApplicationContextAssertProvider<C extends ApplicationContext>
extends ApplicationContext, org.assertj.core.api.AssertProvider<ApplicationContextAssert<C>>, Closeable
An
ApplicationContext that additionally supports AssertJ style assertions. Can
be used to decorate an existing application context or an application context that
failed to start.
Assertions can be applied using the standard AssertJ assertThat(...) style (see
ApplicationContextAssert for a complete list). For example:
assertThat(applicationContext).hasSingleBean(MyBean.class);
If the original ApplicationContext is needed for any reason the
getSourceApplicationContext() method can be used.
Any ApplicationContext method called on a context that has failed to start will
throw an IllegalStateException.
- 从以下版本开始:
- 2.0.0
- 作者:
- Phillip Webb
- 另请参阅:
-
字段概要
从接口继承的字段 org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX, FACTORY_BEAN_PREFIX_CHAR从接口继承的字段 org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX从接口继承的字段 org.springframework.core.io.support.ResourcePatternResolver
CLASSPATH_ALL_URL_PREFIX -
方法概要
修饰符和类型方法说明已过时。to prevent accidental use.voidclose()static <T extends ApplicationContextAssertProvider<C>,C extends ApplicationContext>
TFactory method to create a newApplicationContextAssertProviderinstance.static <T extends ApplicationContextAssertProvider<C>,C extends ApplicationContext>
Tget(Class<T> type, Class<? extends C> contextType, Supplier<? extends C> contextSupplier, Class<?>... additionalContextInterfaces) Factory method to create a newApplicationContextAssertProviderinstance.Return the original sourceApplicationContext.<T extends C>
TgetSourceApplicationContext(Class<T> requiredType) Return the original sourceApplicationContext, casting it to the requested type.Return the failure that caused application context to fail ornullif the context started without issue.从接口继承的方法 org.springframework.context.ApplicationContext
getApplicationName, getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate从接口继承的方法 org.springframework.context.ApplicationEventPublisher
publishEvent, publishEvent从接口继承的方法 org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch从接口继承的方法 org.springframework.core.env.EnvironmentCapable
getEnvironment从接口继承的方法 org.springframework.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory从接口继承的方法 org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation从接口继承的方法 org.springframework.context.MessageSource
getMessage, getMessage, getMessage从接口继承的方法 org.springframework.core.io.ResourceLoader
getClassLoader, getResource从接口继承的方法 org.springframework.core.io.support.ResourcePatternResolver
getResources
-
方法详细资料
-
assertThat
已过时。to prevent accidental use. Prefer standard AssertJassertThat(context)...calls instead.Return an assert for AspectJ.- 指定者:
assertThat在接口中org.assertj.core.api.AssertProvider<C extends ApplicationContext>- 返回:
- an AspectJ assert
-
getSourceApplicationContext
C getSourceApplicationContext()Return the original sourceApplicationContext.- 返回:
- the source application context
- 抛出:
IllegalStateException- if the source context failed to start
-
getSourceApplicationContext
Return the original sourceApplicationContext, casting it to the requested type.- 类型参数:
T- the context type- 参数:
requiredType- the required context type- 返回:
- the source application context
- 抛出:
IllegalStateException- if the source context failed to start
-
getStartupFailure
Throwable getStartupFailure()Return the failure that caused application context to fail ornullif the context started without issue.- 返回:
- the startup failure or
null
-
close
void close()- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable
-
get
static <T extends ApplicationContextAssertProvider<C>,C extends ApplicationContext> T get(Class<T> type, Class<? extends C> contextType, Supplier<? extends C> contextSupplier) Factory method to create a newApplicationContextAssertProviderinstance.- 类型参数:
T- the assert provider typeC- the context type- 参数:
type- the type ofApplicationContextAssertProviderrequired (must be an interface)contextType- the type ofApplicationContextbeing managed (must be an interface)contextSupplier- a supplier that will either return a fully configuredApplicationContextor throw an exception if the context fails to start.- 返回:
- a
ApplicationContextAssertProviderinstance
-
get
static <T extends ApplicationContextAssertProvider<C>,C extends ApplicationContext> T get(Class<T> type, Class<? extends C> contextType, Supplier<? extends C> contextSupplier, Class<?>... additionalContextInterfaces) Factory method to create a newApplicationContextAssertProviderinstance.- 类型参数:
T- the assert provider typeC- the context type- 参数:
type- the type ofApplicationContextAssertProviderrequired (must be an interface)contextType- the type ofApplicationContextbeing managed (must be an interface)contextSupplier- a supplier that will either return a fully configuredApplicationContextor throw an exception if the context fails to start.additionalContextInterfaces- and additional context interfaces to add to the proxy- 返回:
- a
ApplicationContextAssertProviderinstance - 从以下版本开始:
- 3.4.0
-