org.springframework.web.context.WebApplicationContext.getType()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(115)

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

WebApplicationContext.getType介绍

暂无

代码示例

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

@Override
@Nullable
public Class<?> getType(ELContext elContext, @Nullable Object base, Object property) throws ELException {
  if (base == null) {
    String beanName = property.toString();
    WebApplicationContext wac = getWebApplicationContext(elContext);
    if (wac.containsBean(beanName)) {
      elContext.setPropertyResolved(true);
      return wac.getType(beanName);
    }
  }
  return null;
}

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

return wac.getType(beanName);

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

@Override
@Nullable
public Class<?> getType(ELContext elContext, @Nullable Object base, Object property) throws ELException {
  if (base == null) {
    String beanName = property.toString();
    WebApplicationContext wac = getWebApplicationContext(elContext);
    if (wac.containsBean(beanName)) {
      elContext.setPropertyResolved(true);
      return wac.getType(beanName);
    }
  }
  return null;
}

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

return wac.getType(beanName);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

@Override
@Nullable
public Class<?> getType(ELContext elContext, @Nullable Object base, Object property) throws ELException {
  if (base == null) {
    String beanName = property.toString();
    WebApplicationContext wac = getWebApplicationContext(elContext);
    if (wac.containsBean(beanName)) {
      elContext.setPropertyResolved(true);
      return wac.getType(beanName);
    }
  }
  return null;
}

代码示例来源:origin: apache/servicemix-bundles

@Override
@Nullable
public Class<?> getType(ELContext elContext, @Nullable Object base, Object property) throws ELException {
  if (base == null) {
    String beanName = property.toString();
    WebApplicationContext wac = getWebApplicationContext(elContext);
    if (wac.containsBean(beanName)) {
      elContext.setPropertyResolved(true);
      return wac.getType(beanName);
    }
  }
  return null;
}

代码示例来源:origin: badqiu/rapid-framework

private void createSpringDestinations(Service remotingService) {
  WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(broker.getInitServletContext());
  List<String> addedBeanNames = new ArrayList();
  for(String beanName : wac.getBeanDefinitionNames()) {
    Class type = wac.getType(beanName);
    
    boolean isCreateSpringDestination = type.isAnnotationPresent(RemotingObject.class) 
                  || beanName.endsWith(includeEndsWithBeans) 
                  || isCreateDestination(beanName,type);
    
    if(isCreateSpringDestination) {
      createSpringDestination(remotingService, beanName);
      addedBeanNames.add(beanName);
    }
  }
  System.out.println("[Auto Export Spring to BlazeDS RemotingDestination],beanNames="+addedBeanNames);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

return wac.getType(beanName);

代码示例来源:origin: apache/servicemix-bundles

return wac.getType(beanName);

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

@Override
@SuppressWarnings("unchecked")
protected void detectUIs() {
  logger.info("Checking the application context for Vaadin UIs");
  final String[] uiBeanNames = getWebApplicationContext().getBeanNamesForAnnotation(VaadinUI.class);
  for (String uiBeanName : uiBeanNames) {
    Class<?> beanType = getWebApplicationContext().getType(uiBeanName);
    if (UI.class.isAssignableFrom(beanType)) {
      logger.info("Found Vaadin UI [{}]", beanType.getCanonicalName());
      final String path = getWebApplicationContext().findAnnotationOnBean(uiBeanName, VaadinUI.class).path();
      Class<? extends UI> existingBeanType = getUIByPath(path);
      if (existingBeanType != null) {
        throw new IllegalStateException(String.format("[%s] is already mapped to the path [%s]", existingBeanType.getCanonicalName(), path));
      }
      logger.debug("Mapping Vaadin UI [{}] to path [{}]", beanType.getCanonicalName(), path);
      mapPathToUI(path, (Class<? extends UI>) beanType);
    }
  }
}

代码示例来源:origin: alibaba/webx-restful

private synchronized void init() {
  if (restfulComponent != null) {
    return;
  }
  WebApplicationContext applicationContext = component.getApplicationContext();
  ApplicationImpl config = new ApplicationImpl();
  String[] beanNames = applicationContext.getBeanDefinitionNames();
  for (String beanName : beanNames) {
    Class<?> beanClass = applicationContext.getType(beanName);
    Object bean = applicationContext.getBean(beanName);
    Path pathAnnotation = beanClass.getAnnotation(Path.class);
    if (pathAnnotation == null) {
      continue;
    }
    if (!ResourceUtils.isAcceptable(beanClass)) {
      continue;
    }
    buildResource(config, beanClass, bean);
  }
  restfulComponent = new RestfulComponent(config, applicationContext);
}

相关文章