Package org.springframework.web.context

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


        WebApplicationContext wac = (WebApplicationContext) base;
        String beanName = property.toString();
        if (logger.isDebugEnabled()) {
          logger.debug("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


        if(grailsApplication != null) {
            return grailsApplication;
        }

        final WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        if (context == null || !context.containsBean(GrailsApplication.APPLICATION_ID)) {
            return null;
        }

        return context.getBean(GrailsApplication.APPLICATION_ID, GrailsApplication.class);
    }
View Full Code Here

      logger.error(message);
      throw new IllegalStateException(message);
    }

    String beanName = ClassUtils.getShortNameAsProperty(endpointClass);
    if (wac.containsBean(beanName)) {
      T endpoint = wac.getBean(beanName, endpointClass);
      if (logger.isTraceEnabled()) {
        logger.trace("Using @ServerEndpoint singleton " + endpoint);
      }
      return endpoint;
View Full Code Here

      }
      return endpoint;
    }

    Component annot = AnnotationUtils.findAnnotation(endpointClass, Component.class);
    if ((annot != null) && wac.containsBean(annot.value())) {
      T endpoint = wac.getBean(annot.value(), endpointClass);
      if (logger.isTraceEnabled()) {
        logger.trace("Using @ServerEndpoint singleton " + endpoint);
      }
      return endpoint;
View Full Code Here

    assertNotNull(servlets.get(SERVLET_NAME));

    DispatcherServlet servlet = (DispatcherServlet) servlets.get(SERVLET_NAME);
    WebApplicationContext servletContext = servlet.getWebApplicationContext();

    assertTrue(servletContext.containsBean("bean"));
    assertTrue(servletContext.getBean("bean") instanceof MyBean);

    assertEquals(1, registrations.size());
    assertNotNull(registrations.get(SERVLET_NAME));
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

    DispatcherServlet servlet = (DispatcherServlet) servlets.get(SERVLET_NAME);
    WebApplicationContext wac = servlet.getWebApplicationContext();
    ((AnnotationConfigWebApplicationContext) wac).refresh();

    assertTrue(wac.containsBean("bean"));
    assertTrue(wac.getBean("bean") instanceof MyBean);

    assertEquals(1, servletRegistrations.size());
    assertNotNull(servletRegistrations.get(SERVLET_NAME));
View Full Code Here

    servlet.init(new MockServletConfig(this.servletContext));

    WebApplicationContext wac = servlet.getWebApplicationContext();
    ((AnnotationConfigWebApplicationContext) wac).refresh();

    assertTrue(wac.containsBean("bean"));
    assertTrue(wac.getBean("bean") instanceof MyBean);
  }

  @Test
  public void noFilters() throws ServletException {
View Full Code Here

   * @return the MultipartResolver instance, or {@code null} 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

        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.