org.springframework.context.ApplicationContext.isTypeMatch()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中org.springframework.context.ApplicationContext.isTypeMatch()方法的一些代码示例,展示了ApplicationContext.isTypeMatch()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ApplicationContext.isTypeMatch()方法的具体详情如下:
包路径:org.springframework.context.ApplicationContext
类名称:ApplicationContext
方法名:isTypeMatch

ApplicationContext.isTypeMatch介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
@Nullable
public View resolveViewName(String viewName, Locale locale) throws BeansException {
  ApplicationContext context = obtainApplicationContext();
  if (!context.containsBean(viewName)) {
    // Allow for ViewResolver chaining...
    return null;
  }
  if (!context.isTypeMatch(viewName, View.class)) {
    if (logger.isDebugEnabled()) {
      logger.debug("Found bean named '" + viewName + "' but it does not implement View");
    }
    // Since we're looking into the general ApplicationContext here,
    // let's accept this as a non-match and allow for chaining as well...
    return null;
  }
  return context.getBean(viewName, View.class);
}

代码示例来源:origin: org.springframework/spring-webmvc

@Override
@Nullable
public View resolveViewName(String viewName, Locale locale) throws BeansException {
  ApplicationContext context = obtainApplicationContext();
  if (!context.containsBean(viewName)) {
    // Allow for ViewResolver chaining...
    return null;
  }
  if (!context.isTypeMatch(viewName, View.class)) {
    if (logger.isDebugEnabled()) {
      logger.debug("Found bean named '" + viewName + "' but it does not implement View");
    }
    // Since we're looking into the general ApplicationContext here,
    // let's accept this as a non-match and allow for chaining as well...
    return null;
  }
  return context.getBean(viewName, View.class);
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void typeCheck() {
  assertTrue(this.context.isTypeMatch("default", Executor.class));
  assertTrue(this.context.isTypeMatch("default", TaskExecutor.class));
  assertTrue(this.context.isTypeMatch("default", ThreadPoolTaskExecutor.class));
}

代码示例来源:origin: Nepxion/Discovery

public boolean isTypeMatch(String name, Class<?> typeToMatch) throws NoSuchBeanDefinitionException {
  return applicationContext.isTypeMatch(name, typeToMatch);
}

代码示例来源:origin: Nepxion/Discovery

public boolean isTypeMatch(String name, ResolvableType typeToMatch) throws NoSuchBeanDefinitionException {
  return applicationContext.isTypeMatch(name, typeToMatch);
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-common

/**
 * @param arg0
 * @param arg1
 * @return
 * @throws NoSuchBeanDefinitionException
 * @see org.springframework.beans.factory.BeanFactory#isTypeMatch(java.lang.String, java.lang.Class)
 */
@SuppressWarnings("unchecked")
public boolean isTypeMatch(String arg0, Class arg1) throws NoSuchBeanDefinitionException {
  return target.isTypeMatch(arg0, arg1);
}

代码示例来源:origin: com.consol.citrus/citrus-ws

public boolean isTypeMatch(String name, ResolvableType targetType)
    throws NoSuchBeanDefinitionException {
  return applicationContext.isTypeMatch(name, targetType);
}
public Class<?> getType(String name)

代码示例来源:origin: net.sf.taverna.t2.infrastructure/platform-spring

/**
 * Delegates to internal ApplicationContext supplied by constructor
 */
@SuppressWarnings("unchecked")
public final boolean isTypeMatch(String arg0, Class arg1)
    throws NoSuchBeanDefinitionException {
  return context.isTypeMatch(arg0, arg1);
}

代码示例来源:origin: com.consol.citrus/citrus-ws

public boolean isTypeMatch(String name, Class<?> targetType)
    throws NoSuchBeanDefinitionException {
  return applicationContext.isTypeMatch(name, targetType);
}
public boolean isTypeMatch(String name, ResolvableType targetType)

代码示例来源:origin: net.javacrumbs/smock-http

public boolean isTypeMatch(String name, Class targetType)
    throws NoSuchBeanDefinitionException {
  return wrappedApplicationContext.isTypeMatch(name, targetType);
}

代码示例来源:origin: unic/neba

@Override
public boolean isTypeMatch(String name, ResolvableType typeToMatch) throws NoSuchBeanDefinitionException {
  return wrapped.isTypeMatch(name, typeToMatch);
}

代码示例来源:origin: org.kuali.student.core/ks-common-util

@Override
public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
  return applicationContext.isTypeMatch(name, targetType);
}

代码示例来源:origin: com.github.drtrang/spring-boot-autoconfigure

public static boolean isTypeMatch(String name, Class<?> typeToMatch) {
  return context.isTypeMatch(name, typeToMatch);
}

代码示例来源:origin: com.nepxion/aquarius-common

public static boolean isTypeMatch(String name, ResolvableType typeToMatch) throws NoSuchBeanDefinitionException {
  return applicationContext.isTypeMatch(name, typeToMatch);
}

代码示例来源:origin: unic/neba

@Override
public boolean isTypeMatch(String name, Class<?> typeToMatch) throws NoSuchBeanDefinitionException {
  return wrapped.isTypeMatch(name, typeToMatch);
}

代码示例来源:origin: Nepxion/Aquarius

public static boolean isTypeMatch(String name, Class<?> typeToMatch) throws NoSuchBeanDefinitionException {
  return applicationContext.isTypeMatch(name, typeToMatch);
}

代码示例来源:origin: com.nepxion/aquarius-common

public static boolean isTypeMatch(String name, Class<?> typeToMatch) throws NoSuchBeanDefinitionException {
  return applicationContext.isTypeMatch(name, typeToMatch);
}

代码示例来源:origin: org.kuali.student.common/ks-common-util

public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
  return applicationContext.isTypeMatch(name, targetType);
}

代码示例来源:origin: apache/archiva

@Override
public boolean isTypeMatch( String s, Class<?> aClass )
  throws NoSuchBeanDefinitionException
{
  return applicationContext.isTypeMatch( s, aClass );
}

代码示例来源:origin: org.carewebframework/org.carewebframework.api

/**
 * Returns the bean with an id matching the specified id, or null if none found.
 * 
 * @param id Bean id
 * @param clazz Expected return type.
 * @return Returns the bean instance whose id matches the specified id, or null if none found or
 *         if the application context cannot be determined.
 */
public static <T> T getBean(String id, Class<T> clazz) {
  ApplicationContext appContext = getAppContext();
  return appContext == null ? null : appContext.containsBean(id) && appContext.isTypeMatch(id, clazz) ? appContext
      .getBean(id, clazz) : null;
}

相关文章