diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java index b5926e7e3a..c51656d2d5 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java @@ -168,7 +168,7 @@ class ConfigurationClassBeanDefinitionReader { this.registry.registerBeanDefinition(definitionHolder.getBeanName(), definitionHolder.getBeanDefinition()); configClass.setBeanName(configBeanName); if (logger.isDebugEnabled()) { - logger.debug(String.format("Registered bean definition for imported @Configuration class %s", configBeanName)); + logger.debug("Registered bean definition for imported class '" + configBeanName + "'"); } } else { diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Import.java b/spring-context/src/main/java/org/springframework/context/annotation/Import.java index 6c03d55f69..a9eca05635 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Import.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Import.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 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. @@ -30,16 +30,16 @@ import java.lang.annotation.Target; * one {@link Bean @Bean} method, as well as {@link ImportSelector} and * {@link ImportBeanDefinitionRegistrar} implementations. * - *
{@code @Bean} definitions declared in imported {@code @Configuration} classes - * should be accessed by using {@link org.springframework.beans.factory.annotation.Autowired @Autowired} + *
{@code @Bean} definitions declared in imported {@code @Configuration} classes should be + * accessed by using {@link org.springframework.beans.factory.annotation.Autowired @Autowired} * injection. Either the bean itself can be autowired, or the configuration class instance - * declaring the bean can be autowired. The latter approach allows for explicit, - * IDE-friendly navigation between {@code @Configuration} class methods. + * declaring the bean can be autowired. The latter approach allows for explicit, IDE-friendly + * navigation between {@code @Configuration} class methods. * *
May be declared at the class level or as a meta-annotation. * *
If XML or other non-{@code @Configuration} bean definition resources need to be - * imported, use {@link ImportResource @ImportResource} + * imported, use the {@link ImportResource @ImportResource} annotation instead. * * @author Chris Beams * @since 3.0 @@ -57,4 +57,5 @@ public @interface Import { * {@link ImportBeanDefinitionRegistrar} classes to import. */ Class>[] value(); + } diff --git a/spring-web/src/main/java/org/springframework/web/context/ContextLoader.java b/spring-web/src/main/java/org/springframework/web/context/ContextLoader.java index 16da9161d3..1edc6336c2 100644 --- a/spring-web/src/main/java/org/springframework/web/context/ContextLoader.java +++ b/spring-web/src/main/java/org/springframework/web/context/ContextLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 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. @@ -107,7 +107,6 @@ public class ContextLoader { /** * Config param for the root WebApplicationContext implementation class to use: {@value} * @see #determineContextClass(ServletContext) - * @see #createWebApplicationContext(ServletContext, ApplicationContext) */ public static final String CONTEXT_CLASS_PARAM = "contextClass"; @@ -194,6 +193,7 @@ public class ContextLoader { */ private static volatile WebApplicationContext currentContext; + /** * The root WebApplicationContext instance that this loader manages. */ @@ -360,6 +360,37 @@ public class ContextLoader { return (ConfigurableWebApplicationContext) BeanUtils.instantiateClass(contextClass); } + /** + * Return the WebApplicationContext implementation class to use, either the + * default XmlWebApplicationContext or a custom context class if specified. + * @param servletContext current servlet context + * @return the WebApplicationContext implementation class to use + * @see #CONTEXT_CLASS_PARAM + * @see org.springframework.web.context.support.XmlWebApplicationContext + */ + protected Class> determineContextClass(ServletContext servletContext) { + String contextClassName = servletContext.getInitParameter(CONTEXT_CLASS_PARAM); + if (contextClassName != null) { + try { + return ClassUtils.forName(contextClassName, ClassUtils.getDefaultClassLoader()); + } + catch (ClassNotFoundException ex) { + throw new ApplicationContextException( + "Failed to load custom context class [" + contextClassName + "]", ex); + } + } + else { + contextClassName = defaultStrategies.getProperty(WebApplicationContext.class.getName()); + try { + return ClassUtils.forName(contextClassName, ContextLoader.class.getClassLoader()); + } + catch (ClassNotFoundException ex) { + throw new ApplicationContextException( + "Failed to load default context class [" + contextClassName + "]", ex); + } + } + } + /** * @deprecated as of Spring 3.1 in favor of * {@link #createWebApplicationContext(ServletContext)} and @@ -417,7 +448,6 @@ public class ContextLoader { * org.springframework.core.annotation.Order Order} will be sorted appropriately. * @param sc the current servlet context * @param wac the newly created application context - * @see #createWebApplicationContext(ServletContext, ApplicationContext) * @see #CONTEXT_INITIALIZER_CLASSES_PARAM * @see ApplicationContextInitializer#initialize(ConfigurableApplicationContext) */ @@ -451,37 +481,6 @@ public class ContextLoader { } } - /** - * Return the WebApplicationContext implementation class to use, either the - * default XmlWebApplicationContext or a custom context class if specified. - * @param servletContext current servlet context - * @return the WebApplicationContext implementation class to use - * @see #CONTEXT_CLASS_PARAM - * @see org.springframework.web.context.support.XmlWebApplicationContext - */ - protected Class> determineContextClass(ServletContext servletContext) { - String contextClassName = servletContext.getInitParameter(CONTEXT_CLASS_PARAM); - if (contextClassName != null) { - try { - return ClassUtils.forName(contextClassName, ClassUtils.getDefaultClassLoader()); - } - catch (ClassNotFoundException ex) { - throw new ApplicationContextException( - "Failed to load custom context class [" + contextClassName + "]", ex); - } - } - else { - contextClassName = defaultStrategies.getProperty(WebApplicationContext.class.getName()); - try { - return ClassUtils.forName(contextClassName, ContextLoader.class.getClassLoader()); - } - catch (ClassNotFoundException ex) { - throw new ApplicationContextException( - "Failed to load default context class [" + contextClassName + "]", ex); - } - } - } - /** * Return the {@link ApplicationContextInitializer} implementation classes to use * if any have been specified by {@link #CONTEXT_INITIALIZER_CLASSES_PARAM}. diff --git a/spring-web/src/main/java/org/springframework/web/context/ContextLoaderListener.java b/spring-web/src/main/java/org/springframework/web/context/ContextLoaderListener.java index 83aff2d3de..42bcd77f1c 100644 --- a/spring-web/src/main/java/org/springframework/web/context/ContextLoaderListener.java +++ b/spring-web/src/main/java/org/springframework/web/context/ContextLoaderListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 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. @@ -23,14 +23,13 @@ import javax.servlet.ServletContextListener; * Bootstrap listener to start up and shut down Spring's root {@link WebApplicationContext}. * Simply delegates to {@link ContextLoader} as well as to {@link ContextCleanupListener}. * - *
This listener should be registered after - * {@link org.springframework.web.util.Log4jConfigListener} + *
This listener should be registered after {@link org.springframework.web.util.Log4jConfigListener} * in {@code web.xml}, if the latter is used. * *
As of Spring 3.1, {@code ContextLoaderListener} supports injecting the root web
* application context via the {@link #ContextLoaderListener(WebApplicationContext)}
- * constructor, allowing for programmatic configuration in Servlet 3.0+ environments. See
- * {@link org.springframework.web.WebApplicationInitializer} for usage examples.
+ * constructor, allowing for programmatic configuration in Servlet 3.0+ environments.
+ * See {@link org.springframework.web.WebApplicationInitializer} for usage examples.
*
* @author Juergen Hoeller
* @author Chris Beams
@@ -98,6 +97,7 @@ public class ContextLoaderListener extends ContextLoader implements ServletConte
super(context);
}
+
/**
* Initialize the root web application context.
*/
diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java
index 528f83328b..31ac98086e 100644
--- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java
+++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -232,7 +232,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
* having a chance to resolve an argument value before the standard
* argument handling kicks in.
*/
- public void setCustomArgumentResolvers(WebArgumentResolver[] argumentResolvers) {
+ public void setCustomArgumentResolvers(WebArgumentResolver... argumentResolvers) {
this.customArgumentResolvers = argumentResolvers;
}
@@ -250,7 +250,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
* Any such custom ModelAndViewResolver will kick in first, having a chance to
* resolve an return value before the standard ModelAndView handling kicks in.
*/
- public void setCustomModelAndViewResolvers(ModelAndViewResolver[] customModelAndViewResolvers) {
+ public void setCustomModelAndViewResolvers(ModelAndViewResolver... customModelAndViewResolvers) {
this.customModelAndViewResolvers = customModelAndViewResolvers;
}
@@ -381,7 +381,8 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
if (response instanceof EventResponse) {
// Update the existing model, if any, when responding to an event -
// whereas we're replacing the model in case of an action response.
- Map Any such custom WebArgumentResolver will kick in first, having a chance to resolve
* an argument value before the standard argument handling kicks in.
*/
- public void setCustomArgumentResolvers(WebArgumentResolver[] argumentResolvers) {
+ public void setCustomArgumentResolvers(WebArgumentResolver... argumentResolvers) {
this.customArgumentResolvers = argumentResolvers;
}
@@ -352,7 +352,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
* Any such custom ModelAndViewResolver will kick in first, having a chance to resolve
* a return value before the standard ModelAndView handling kicks in.
*/
- public void setCustomModelAndViewResolvers(ModelAndViewResolver[] customModelAndViewResolvers) {
+ public void setCustomModelAndViewResolvers(ModelAndViewResolver... customModelAndViewResolvers) {
this.customModelAndViewResolvers = customModelAndViewResolvers;
}
@@ -929,7 +929,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
// to be picked up by the RedirectView
webRequest.getRequest().setAttribute(View.RESPONSE_STATUS_ATTRIBUTE, responseStatus);
- responseArgumentUsed = true;
+ this.responseArgumentUsed = true;
}
// Invoke custom resolvers if present...
@@ -992,8 +992,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
}
}
- private void handleResponseBody(Object returnValue, ServletWebRequest webRequest)
- throws Exception {
+ private void handleResponseBody(Object returnValue, ServletWebRequest webRequest) throws Exception {
if (returnValue == null) {
return;
}
@@ -1002,8 +1001,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
writeWithMessageConverters(returnValue, inputMessage, outputMessage);
}
- private void handleHttpEntityResponse(HttpEntity> responseEntity, ServletWebRequest webRequest)
- throws Exception {
+ private void handleHttpEntityResponse(HttpEntity> responseEntity, ServletWebRequest webRequest) throws Exception {
if (responseEntity == null) {
return;
}
@@ -1030,6 +1028,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
private void writeWithMessageConverters(Object returnValue,
HttpInputMessage inputMessage, HttpOutputMessage outputMessage)
throws IOException, HttpMediaTypeNotAcceptableException {
+
List