From 99226e0fa651f78a46c1faa06d043e268277df50 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 23 Dec 2016 21:16:43 +0100 Subject: [PATCH] Polishing --- build.gradle | 4 ++-- .../support/GenericXmlApplicationContext.java | 10 +++++++-- .../WebRequestDataBinderIntegrationTests.java | 22 +++++++------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 3d0e69fabc..afe3e4679f 100644 --- a/build.gradle +++ b/build.gradle @@ -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" diff --git a/spring-context/src/main/java/org/springframework/context/support/GenericXmlApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/GenericXmlApplicationContext.java index 4fc2d52b7b..0dcb646eae 100644 --- a/spring-context/src/main/java/org/springframework/context/support/GenericXmlApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/GenericXmlApplicationContext.java @@ -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; * *

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 { 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 diff --git a/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderIntegrationTests.java b/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderIntegrationTests.java index c12711dc23..0e7a5a33e5 100644 --- a/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderIntegrationTests.java +++ b/spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderIntegrationTests.java @@ -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 @@ 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; 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 { @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 { @Test public void partsBinding() { - PartsBean bean = new PartsBean(); partsServlet.setBean(bean); - MultiValueMap parts = new LinkedMultiValueMap(); + MultiValueMap 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 { @Test public void partListBinding() { - PartListBean bean = new PartListBean(); partListServlet.setBean(bean); - MultiValueMap parts = new LinkedMultiValueMap(); + MultiValueMap 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 { 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 { } } + private static class PartsBean { public Part firstPart; @@ -182,10 +173,12 @@ public class WebRequestDataBinderIntegrationTests { } } + @SuppressWarnings("serial") private static class PartsServlet extends AbstractStandardMultipartServlet { } + private static class PartListBean { public List partList; @@ -200,6 +193,7 @@ public class WebRequestDataBinderIntegrationTests { } } + @SuppressWarnings("serial") private static class PartListServlet extends AbstractStandardMultipartServlet { }