createdContext = ctx2; ctx2.setServletConfig(servletConfig); Resource r = ctx2.getResource(location); try {
@Override public void init(ServletConfig config) throws ServletException { applicationContext = WebApplicationContextUtils.getWebApplicationContext(config.getServletContext()); if (config.getInitParameter(CONTEXT_CONFIG_LOCATION_PARAMETER) != null) { XmlWebApplicationContext context = new XmlWebApplicationContext(); context.setParent(applicationContext); context.setConfigLocation(config.getInitParameter(CONTEXT_CONFIG_LOCATION_PARAMETER)); context.setServletConfig(config); context.setServletContext(config.getServletContext()); context.refresh(); applicationContext = context; } if (config.getInitParameter(SYSTEM_MESSAGES_BEAN_NAME_PARAMETER) != null) { systemMessagesBeanName = config.getInitParameter(SYSTEM_MESSAGES_BEAN_NAME_PARAMETER); logger.debug("found SYSTEM_MESSAGES_BEAN_NAME_PARAMETER: {}", systemMessagesBeanName); } if (SpringApplicationContext.getApplicationContext() == null) { SpringApplicationContext.setApplicationContext(applicationContext); } super.init(config); }
createdContext = ctx2; ctx2.setServletConfig(servletConfig); Resource r = ctx2.getResource(location); try {
createdContext = ctx2; ctx2.setServletConfig(servletConfig); Resource r = ctx2.getResource(location); try {
public DispatcherServletChannelInitializer() throws ServletException { MockServletContext servletContext = new MockServletContext(); MockServletConfig servletConfig = new MockServletConfig(servletContext); XmlWebApplicationContext wac = new XmlWebApplicationContext(); wac.setServletContext(servletContext); wac.setServletConfig(servletConfig); wac.setConfigLocations(new String[] { "classpath:/servlet-context.xml", "classpath:dubbo-consumer.xml" }); wac.refresh(); this.dispatcherServlet = new DispatcherServlet(wac); this.dispatcherServlet.init(servletConfig); }
public DispatcherServletChannelInitializer() throws ServletException { MockServletContext servletContext = new MockServletContext(); MockServletConfig servletConfig = new MockServletConfig(servletContext); servletConfig.addInitParameter("contextConfigLocation","classpath:/META-INF/spring/root-context.xml"); servletContext.addInitParameter("contextConfigLocation","classpath:/META-INF/spring/root-context.xml"); //AnnotationConfigWebApplicationContext wac = new AnnotationConfigWebApplicationContext(); XmlWebApplicationContext wac = new XmlWebApplicationContext(); //ClassPathXmlApplicationContext wac = new ClassPathXmlApplicationContext(); wac.setServletContext(servletContext); wac.setServletConfig(servletConfig); wac.setConfigLocation("classpath:/servlet-context.xml"); //wac.register(WebConfig.class); wac.refresh(); this.dispatcherServlet = new DispatcherServlet(wac); this.dispatcherServlet.init(servletConfig); }