mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-05-02 12:03:41 +01:00
Clean up property values registration in SimpleWebApplicationContext
Closes gh-22787
This commit is contained in:
+3
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,10 +47,6 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext {
|
||||
|
||||
@Override
|
||||
public void refresh() throws BeansException {
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.add("commandClass", "org.springframework.tests.sample.beans.TestBean");
|
||||
pvs.add("formView", "form");
|
||||
|
||||
registerSingleton("/locale.do", LocaleChecker.class);
|
||||
|
||||
addMessage("test", Locale.ENGLISH, "test message");
|
||||
@@ -63,7 +59,7 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext {
|
||||
registerSingleton("handlerMapping", BeanNameUrlHandlerMapping.class);
|
||||
registerSingleton("viewResolver", InternalResourceViewResolver.class);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.add("location", "org/springframework/web/context/WEB-INF/sessionContext.xml");
|
||||
registerSingleton("viewResolver2", XmlViewResolver.class, pvs);
|
||||
|
||||
@@ -76,6 +72,7 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext {
|
||||
@Override
|
||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
if (!(RequestContextUtils.findWebApplicationContext(request) instanceof SimpleWebApplicationContext)) {
|
||||
throw new ServletException("Incorrect WebApplicationContext");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user