Package org.springframework.web.context

Examples of org.springframework.web.context.WebApplicationContext.containsBean()


  protected Object getBean(String name) {
    WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
    if( applicationContext == null ) {
      throw new IllegalStateException("No Spring web application context found");
    }
    if( !applicationContext.containsBean(name) ) {
      {
        throw new IllegalArgumentException("Spring bean not found: " + name);
      }
    }
    return applicationContext.getBean(name);
View Full Code Here


        FacesContext facesContext = FacesContext.getCurrentInstance();

        WebApplicationContext wac = getWebApplicationContext(facesContext);

        if (wac.containsBean(componentType)) {
            if (logger.isDebugEnabled()) {
                logger.debug("Successfully found component '" + componentType +
                    "' in root WebApplicationContext");
            }
View Full Code Here

        FacesContext facesContext = FacesContext.getCurrentInstance();

        WebApplicationContext wac = getWebApplicationContext(facesContext);

        if (wac.containsBean(converterId)) {
            if (logger.isDebugEnabled()) {
                logger.debug("Successfully found converter '" + converterId +
                    "' in root WebApplicationContext");
            }
View Full Code Here

        FacesContext facesContext = FacesContext.getCurrentInstance();

        WebApplicationContext wac = getWebApplicationContext(facesContext);

        if (wac.containsBean("converters")) {
            Map<String, Converter> converters = (Map<String, Converter>)wac.getBean("converters");
            
            Converter converter = converters.get(CrudUtils.getClassEntityName(targetClass));
            return converter;
        }
View Full Code Here

        FacesContext facesContext = FacesContext.getCurrentInstance();

        WebApplicationContext wac = getWebApplicationContext(facesContext);

        if (wac.containsBean(validatorId)) {
            if (logger.isDebugEnabled()) {
                logger.debug("Successfully found validator '" + validatorId +
                    "' in root WebApplicationContext");
            }
View Full Code Here

    WebApplicationContext applicationContext = WebApplicationContextUtils
        .getWebApplicationContext(getServletContext());
    if (applicationContext == null) {
      throw new IllegalStateException("No Spring web application context found");
    }
    if (!applicationContext.containsBean(name)) {
      {
        throw new IllegalArgumentException("Spring bean not found: " + name);
      }
    }
    return applicationContext.getBean(name);
View Full Code Here

   * @return the MultipartResolver instance, or <code>null</code> if none found
   */
  protected MultipartResolver lookupMultipartResolver() {
    WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
    String beanName = getMultipartResolverBeanName();
    if (wac != null && wac.containsBean(beanName)) {
      if (logger.isDebugEnabled()) {
        logger.debug("Using MultipartResolver '" + beanName + "' for MultipartFilter");
      }
      return wac.getBean(beanName, MultipartResolver.class);
    }
View Full Code Here

    String emfBeanName = getEntityManagerFactoryBeanName();
    String puName = getPersistenceUnitName();
    if (StringUtils.hasLength(emfBeanName)) {
      return wac.getBean(emfBeanName, EntityManagerFactory.class);
    }
    else if (!StringUtils.hasLength(puName) && wac.containsBean(DEFAULT_ENTITY_MANAGER_FACTORY_BEAN_NAME)) {
      return wac.getBean(DEFAULT_ENTITY_MANAGER_FACTORY_BEAN_NAME, EntityManagerFactory.class);
    }
    else {
      // Includes fallback search for single EntityManagerFactory bean by type.
      return EntityManagerFactoryUtils.findEntityManagerFactory(wac, puName);
View Full Code Here

    WebApplicationContext applicationContext = WebApplicationContextUtils
        .getWebApplicationContext(getServletContext());
    if (applicationContext == null) {
      throw new IllegalStateException("No Spring web application context found");
    }
    if (!applicationContext.containsBean(name)) {
      {
        throw new IllegalArgumentException("Spring bean not found: " + name);
      }
    }
    return applicationContext.getBean(name);
View Full Code Here

        WebApplicationContext wac = (WebApplicationContext) base;
        String beanName = property.toString();
        if (logger.isTraceEnabled()) {
          logger.trace("Attempting to resolve property '" + beanName + "' in root WebApplicationContext");
        }
        if (wac.containsBean(beanName)) {
          if (logger.isDebugEnabled()) {
            logger.debug("Successfully resolved property '" + beanName + "' in root WebApplicationContext");
          }
          elContext.setPropertyResolved(true);
          try {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.