Browse Source

Polishing

pull/1290/head
Juergen Hoeller 9 years ago
parent
commit
99226e0fa6
  1. 4
      build.gradle
  2. 10
      spring-context/src/main/java/org/springframework/context/support/GenericXmlApplicationContext.java
  3. 22
      spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderIntegrationTests.java

4
build.gradle

@ -55,8 +55,8 @@ configure(allprojects) { project -> @@ -55,8 +55,8 @@ configure(allprojects) { project ->
ext.jackson2Version = "2.8.5"
ext.jasperreportsVersion = "6.2.1" // our tests fail with JR-internal NPEs against 6.2.2 and higher
ext.javamailVersion = "1.5.6"
ext.jettyVersion = "9.3.14.v20161028"
ext.jetty94Version = "9.4.0.v20161208" // for spring-websocket support
ext.jettyVersion = "9.3.14.v20161028" // as of 9.3.15, Jetty has hard Servlet 3.1 requirement
ext.jetty94Version = "9.4.0.v20161208" // for spring-websocket support, optimized for Jetty 9.4
ext.jodaVersion = "2.9.6"
ext.jrubyVersion = "1.7.26" // JRuby 9000 only supported through JSR-223 (StandardScriptFactory)
ext.jtaVersion = "1.2"

10
spring-context/src/main/java/org/springframework/context/support/GenericXmlApplicationContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 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.
@ -29,7 +29,8 @@ import org.springframework.core.io.Resource; @@ -29,7 +29,8 @@ import org.springframework.core.io.Resource;
*
* <p>In case of multiple configuration files, bean definitions in later files
* will override those defined in earlier files. This can be leveraged to
* deliberately override certain bean definitions via an extra configuration file.
* intentionally override certain bean definitions via an extra configuration
* file appended to the list.
*
* @author Juergen Hoeller
* @author Chris Beams
@ -108,6 +109,11 @@ public class GenericXmlApplicationContext extends GenericApplicationContext { @@ -108,6 +109,11 @@ public class GenericXmlApplicationContext extends GenericApplicationContext {
this.reader.setEnvironment(getEnvironment());
}
//---------------------------------------------------------------------
// Convenient methods for loading XML bean definition files
//---------------------------------------------------------------------
/**
* Load bean definitions from the given XML resources.
* @param resources one or more resources to load from

22
spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -16,10 +16,8 @@ @@ -16,10 +16,8 @@
package org.springframework.web.bind.support;
import java.io.IOException;
import java.util.List;
import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -30,7 +28,6 @@ import org.eclipse.jetty.server.NetworkConnector; @@ -30,7 +28,6 @@ import org.eclipse.jetty.server.NetworkConnector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@ -67,7 +64,6 @@ public class WebRequestDataBinderIntegrationTests { @@ -67,7 +64,6 @@ public class WebRequestDataBinderIntegrationTests {
@BeforeClass
public static void startJettyServer() throws Exception {
// Let server pick its own random, available port.
jettyServer = new Server(0);
@ -101,11 +97,10 @@ public class WebRequestDataBinderIntegrationTests { @@ -101,11 +97,10 @@ public class WebRequestDataBinderIntegrationTests {
@Test
public void partsBinding() {
PartsBean bean = new PartsBean();
partsServlet.setBean(bean);
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
Resource firstPart = new ClassPathResource("/org/springframework/http/converter/logo.jpg");
parts.add("firstPart", firstPart);
parts.add("secondPart", "secondValue");
@ -118,11 +113,10 @@ public class WebRequestDataBinderIntegrationTests { @@ -118,11 +113,10 @@ public class WebRequestDataBinderIntegrationTests {
@Test
public void partListBinding() {
PartListBean bean = new PartListBean();
partListServlet.setBean(bean);
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
parts.add("partList", "first value");
parts.add("partList", "second value");
Resource logo = new ClassPathResource("/org/springframework/http/converter/logo.jpg");
@ -141,14 +135,10 @@ public class WebRequestDataBinderIntegrationTests { @@ -141,14 +135,10 @@ public class WebRequestDataBinderIntegrationTests {
private T bean;
@Override
public void service(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
public void service(HttpServletRequest request, HttpServletResponse response) {
WebRequestDataBinder binder = new WebRequestDataBinder(bean);
ServletWebRequest webRequest = new ServletWebRequest(request, response);
binder.bind(webRequest);
response.setStatus(HttpServletResponse.SC_OK);
}
@ -157,6 +147,7 @@ public class WebRequestDataBinderIntegrationTests { @@ -157,6 +147,7 @@ public class WebRequestDataBinderIntegrationTests {
}
}
private static class PartsBean {
public Part firstPart;
@ -182,10 +173,12 @@ public class WebRequestDataBinderIntegrationTests { @@ -182,10 +173,12 @@ public class WebRequestDataBinderIntegrationTests {
}
}
@SuppressWarnings("serial")
private static class PartsServlet extends AbstractStandardMultipartServlet<PartsBean> {
}
private static class PartListBean {
public List<Part> partList;
@ -200,6 +193,7 @@ public class WebRequestDataBinderIntegrationTests { @@ -200,6 +193,7 @@ public class WebRequestDataBinderIntegrationTests {
}
}
@SuppressWarnings("serial")
private static class PartListServlet extends AbstractStandardMultipartServlet<PartListBean> {
}

Loading…
Cancel
Save