Package org.springframework.web.context.support

Examples of org.springframework.web.context.support.GenericWebApplicationContext.refresh()


        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(VariableNamesController.class));
        RootBeanDefinition mappingDef = new RootBeanDefinition(DefaultAnnotationHandlerMapping.class);
        mappingDef.getPropertyValues().add("useDefaultSuffixPattern", false);
        wac.registerBeanDefinition("handlerMapping", mappingDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here


        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(ControllerClassNameController.class));
        RootBeanDefinition mapping = new RootBeanDefinition(ControllerClassNameHandlerMapping.class);
        mapping.getPropertyValues().add("excludedPackages", null);
        wac.registerBeanDefinition("handlerMapping", mapping);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

        DefaultAdvisorAutoProxyCreator autoProxyCreator = new DefaultAdvisorAutoProxyCreator();
        autoProxyCreator.setProxyTargetClass(true);
        autoProxyCreator.setBeanFactory(wac.getBeanFactory());
        wac.getBeanFactory().addBeanPostProcessor(autoProxyCreator);
        wac.getBeanFactory().registerSingleton("advisor", new DefaultPointcutAdvisor(new SimpleTraceInterceptor(true)));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
  }
View Full Code Here

        if (initializer != null) {
          initializer.initialize(wac);
        }

        wac.refresh();
        return wac;
      }
    };

    servlet.init(new MockServletConfig());
View Full Code Here

  private Map<String, Object> model = new HashMap<String, Object>();

  @Before
  public void init() {
    GenericWebApplicationContext applicationContext = new GenericWebApplicationContext();
    applicationContext.refresh();
    servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext);
  }

  @Test
  public void testGetContextUrl() throws Exception {
View Full Code Here

    List<HandlerMethodArgumentResolver> customResolvers = new ArrayList<HandlerMethodArgumentResolver>();
    customResolvers.add(new ServletWebArgumentResolverAdapter(new ColorArgumentResolver()));

    GenericWebApplicationContext context = new GenericWebApplicationContext();
    context.refresh();

    handlerAdapter = new RequestMappingHandlerAdapter();
    handlerAdapter.setWebBindingInitializer(bindingInitializer);
    handlerAdapter.setCustomArgumentResolvers(customResolvers);
    handlerAdapter.setApplicationContext(context);
View Full Code Here

    GenericWebApplicationContext ac = new GenericWebApplicationContext(sc);
    GenericBeanDefinition bd = new GenericBeanDefinition();
    bd.setBeanClass(DerivedTestBean.class);
    bd.setScope(scope);
    ac.registerBeanDefinition(NAME, bd);
    ac.refresh();
    return ac;
  }

  @Test
  public void testRequestScope() {
View Full Code Here

        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        RootBeanDefinition mapping = new RootBeanDefinition(ControllerClassNameHandlerMapping.class);
        mapping.getPropertyValues().add("excludedPackages", null);
        wac.registerBeanDefinition("handlerMapping", mapping);
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MethodNameDispatchingController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

      @Override
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller",
            new RootBeanDefinition(MyPostMethodNameDispatchingController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

        RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
        StringHttpMessageConverter converter = new StringHttpMessageConverter();
        converter.setSupportedMediaTypes(Collections.singletonList(new MediaType("text", "plain")));
        adapterDef.getPropertyValues().add("messageConverters", converter);
        wac.registerBeanDefinition("handlerAdapter", adapterDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
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.