接口 ApplicationContextAssertProvider<C extends cn.taketoday.context.ApplicationContext>

类型参数:
C - the application context type
所有超级接口:
cn.taketoday.context.ApplicationContext, cn.taketoday.context.ApplicationEventPublisher, org.assertj.core.api.AssertProvider<ApplicationContextAssert<C>>, AutoCloseable, cn.taketoday.beans.factory.BeanFactory, Closeable, cn.taketoday.beans.factory.support.DependencyInjectorProvider, cn.taketoday.core.env.EnvironmentCapable, cn.taketoday.beans.factory.HierarchicalBeanFactory, cn.taketoday.context.MessageSource, cn.taketoday.core.io.PatternResourceLoader, cn.taketoday.core.io.ResourceLoader
所有已知子接口:
AssertableApplicationContext, AssertableReactiveWebApplicationContext, AssertableWebApplicationContext

public interface ApplicationContextAssertProvider<C extends cn.taketoday.context.ApplicationContext> extends cn.taketoday.context.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.

从以下版本开始:
4.0
作者:
Phillip Webb
另请参阅:
  • 嵌套类概要

    从接口继承的嵌套类/接口 cn.taketoday.context.ApplicationContext

    cn.taketoday.context.ApplicationContext.State
  • 字段概要

    从接口继承的字段 cn.taketoday.context.ApplicationContext

    APPLICATION_NAME

    从接口继承的字段 cn.taketoday.beans.factory.BeanFactory

    FACTORY_BEAN_PREFIX

    从接口继承的字段 cn.taketoday.core.io.PatternResourceLoader

    CLASSPATH_ALL_URL_PREFIX

    从接口继承的字段 cn.taketoday.core.io.ResourceLoader

    CLASSPATH_URL_PREFIX
  • 方法概要

    修饰符和类型
    方法
    说明
    已过时。
    to prevent accidental use.
    void
     
    static <T extends ApplicationContextAssertProvider<C>, C extends cn.taketoday.context.ApplicationContext>
    T
    get(Class<T> type, Class<? extends C> contextType, Supplier<? extends C> contextSupplier)
    Factory method to create a new ApplicationContextAssertProvider instance.
    Return the original source ApplicationContext.
    <T extends C>
    T
    Return the original source ApplicationContext, casting it to the requested type.
    Return the failure that caused application context to fail or null if the context started without issue.

    从接口继承的方法 cn.taketoday.context.ApplicationContext

    getApplicationName, getAutowireCapableBeanFactory, getBeanFactory, getDisplayName, getEnvironment, getExpressionEvaluator, getId, getParent, getStartupDate, getState, hasStarted, unwrapFactory

    从接口继承的方法 cn.taketoday.context.ApplicationEventPublisher

    publishEvent, publishEvent

    从接口继承的方法 cn.taketoday.beans.factory.BeanFactory

    containsBean, containsBeanDefinition, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, findSynthesizedAnnotation, getAliases, getAnnotatedBeans, getBean, getBean, getBean, getBean, getBean, getBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeanProvider, getBeanProvider, getBeans, getBeansOfType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getBeansWithAnnotation, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatch, unwrap

    从接口继承的方法 cn.taketoday.beans.factory.support.DependencyInjectorProvider

    getInjector

    从接口继承的方法 cn.taketoday.beans.factory.HierarchicalBeanFactory

    containsLocalBean, getParentBeanFactory

    从接口继承的方法 cn.taketoday.context.MessageSource

    getMessage, getMessage, getMessage

    从接口继承的方法 cn.taketoday.core.io.PatternResourceLoader

    getResources, getResourcesArray, scan

    从接口继承的方法 cn.taketoday.core.io.ResourceLoader

    getClassLoader, getResource
  • 方法详细资料

    • assertThat

      已过时。
      to prevent accidental use. Prefer standard AssertJ assertThat(context)... calls instead.
      Return an assert for AspectJ.
      指定者:
      assertThat 在接口中 org.assertj.core.api.AssertProvider<C extends cn.taketoday.context.ApplicationContext>
      返回:
      an AspectJ assert
    • getSourceApplicationContext

      C getSourceApplicationContext()
      Return the original source ApplicationContext.
      返回:
      the source application context
      抛出:
      IllegalStateException - if the source context failed to start
    • getSourceApplicationContext

      <T extends C> T getSourceApplicationContext(Class<T> requiredType)
      Return the original source ApplicationContext, 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 or null if the context started without issue.
      返回:
      the startup failure or null
    • close

      void close()
      指定者:
      close 在接口中 cn.taketoday.context.ApplicationContext
      指定者:
      close 在接口中 AutoCloseable
      指定者:
      close 在接口中 Closeable
    • get

      static <T extends ApplicationContextAssertProvider<C>, C extends cn.taketoday.context.ApplicationContext> T get(Class<T> type, Class<? extends C> contextType, Supplier<? extends C> contextSupplier)
      Factory method to create a new ApplicationContextAssertProvider instance.
      类型参数:
      T - the assert provider type
      C - the context type
      参数:
      type - the type of ApplicationContextAssertProvider required (must be an interface)
      contextType - the type of ApplicationContext being managed (must be an interface)
      contextSupplier - a supplier that will either return a fully configured ApplicationContext or throw an exception if the context fails to start.
      返回:
      a ApplicationContextAssertProvider instance