Skip to content

Commit b344c92

Browse files
committed
Polishing
(cherry picked from commit 040d131)
1 parent 883c3a6 commit b344c92

File tree

6 files changed

+38
-45
lines changed

6 files changed

+38
-45
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/BeanFactory.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,27 @@
6767
* 1. BeanNameAware's {@code setBeanName}<br>
6868
* 2. BeanClassLoaderAware's {@code setBeanClassLoader}<br>
6969
* 3. BeanFactoryAware's {@code setBeanFactory}<br>
70-
* 4. ResourceLoaderAware's {@code setResourceLoader}
70+
* 4. EnvironmentAware's {@code setEnvironment}
71+
* 5. EmbeddedValueResolverAware's {@code setEmbeddedValueResolver}
72+
* 6. ResourceLoaderAware's {@code setResourceLoader}
7173
* (only applicable when running in an application context)<br>
72-
* 5. ApplicationEventPublisherAware's {@code setApplicationEventPublisher}
74+
* 7. ApplicationEventPublisherAware's {@code setApplicationEventPublisher}
7375
* (only applicable when running in an application context)<br>
74-
* 6. MessageSourceAware's {@code setMessageSource}
76+
* 8. MessageSourceAware's {@code setMessageSource}
7577
* (only applicable when running in an application context)<br>
76-
* 7. ApplicationContextAware's {@code setApplicationContext}
78+
* 9. ApplicationContextAware's {@code setApplicationContext}
7779
* (only applicable when running in an application context)<br>
78-
* 8. ServletContextAware's {@code setServletContext}
80+
* 10. ServletContextAware's {@code setServletContext}
7981
* (only applicable when running in a web application context)<br>
80-
* 9. {@code postProcessBeforeInitialization} methods of BeanPostProcessors<br>
81-
* 10. InitializingBean's {@code afterPropertiesSet}<br>
82-
* 11. a custom init-method definition<br>
83-
* 12. {@code postProcessAfterInitialization} methods of BeanPostProcessors
82+
* 11. {@code postProcessBeforeInitialization} methods of BeanPostProcessors<br>
83+
* 12. InitializingBean's {@code afterPropertiesSet}<br>
84+
* 13. a custom init-method definition<br>
85+
* 14. {@code postProcessAfterInitialization} methods of BeanPostProcessors
8486
*
8587
* <p>On shutdown of a bean factory, the following lifecycle methods apply:<br>
86-
* 1. DisposableBean's {@code destroy}<br>
87-
* 2. a custom destroy-method definition
88+
* 1. {@code postProcessBeforeDestruction} methods of DestructionAwareBeanPostProcessors
89+
* 2. DisposableBean's {@code destroy}<br>
90+
* 3. a custom destroy-method definition
8891
*
8992
* @author Rod Johnson
9093
* @author Juergen Hoeller

spring-context/src/main/java/org/springframework/format/datetime/DateFormatter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -191,7 +191,7 @@ private DateFormat createDateFormat(Locale locale) {
191191
if (timeStyle != -1) {
192192
return DateFormat.getTimeInstance(timeStyle, locale);
193193
}
194-
throw new IllegalStateException("Unsupported style pattern '"+ this.stylePattern+ "'");
194+
throw new IllegalStateException("Unsupported style pattern '" + this.stylePattern + "'");
195195

196196
}
197197
return DateFormat.getDateInstance(this.style, locale);

spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -194,7 +194,7 @@ else if (typeConverter.canConvert(suppliedArg, expectedArg)) {
194194
TypeDescriptor varargsDesc = expectedArgTypes.get(expectedArgTypes.size() - 1);
195195
Class<?> varargsParamType = varargsDesc.getElementTypeDescriptor().getType();
196196

197-
// All remaining parameters must be of this type or convertable to this type
197+
// All remaining parameters must be of this type or convertible to this type
198198
for (int i = expectedArgTypes.size() - 1; i < suppliedArgTypes.size(); i++) {
199199
TypeDescriptor suppliedArg = suppliedArgTypes.get(i);
200200
if (suppliedArg == null) {

spring-tx/src/main/java/org/springframework/dao/support/DataAccessUtils.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -122,7 +122,7 @@ public static <T> T requiredUniqueResult(Collection<T> results) throws Incorrect
122122
/**
123123
* Return a unique result object from the given Collection.
124124
* Throws an exception if 0 or more than 1 result objects found,
125-
* of if the unique result object is not convertable to the
125+
* of if the unique result object is not convertible to the
126126
* specified required type.
127127
* @param results the result Collection (can be {@code null})
128128
* @return the unique result object
@@ -162,15 +162,15 @@ else if (Number.class.isAssignableFrom(requiredType) && Number.class.isInstance(
162162
/**
163163
* Return a unique int result from the given Collection.
164164
* Throws an exception if 0 or more than 1 result objects found,
165-
* of if the unique result object is not convertable to an int.
165+
* of if the unique result object is not convertible to an int.
166166
* @param results the result Collection (can be {@code null})
167167
* @return the unique int result
168168
* @throws IncorrectResultSizeDataAccessException if more than one
169169
* result object has been found in the given Collection
170170
* @throws EmptyResultDataAccessException if no result object
171171
* at all has been found in the given Collection
172172
* @throws TypeMismatchDataAccessException if the unique object
173-
* in the collection is not convertable to an int
173+
* in the collection is not convertible to an int
174174
*/
175175
public static int intResult(Collection<?> results)
176176
throws IncorrectResultSizeDataAccessException, TypeMismatchDataAccessException {
@@ -181,15 +181,15 @@ public static int intResult(Collection<?> results)
181181
/**
182182
* Return a unique long result from the given Collection.
183183
* Throws an exception if 0 or more than 1 result objects found,
184-
* of if the unique result object is not convertable to a long.
184+
* of if the unique result object is not convertible to a long.
185185
* @param results the result Collection (can be {@code null})
186186
* @return the unique long result
187187
* @throws IncorrectResultSizeDataAccessException if more than one
188188
* result object has been found in the given Collection
189189
* @throws EmptyResultDataAccessException if no result object
190190
* at all has been found in the given Collection
191191
* @throws TypeMismatchDataAccessException if the unique object
192-
* in the collection is not convertable to a long
192+
* in the collection is not convertible to a long
193193
*/
194194
public static long longResult(Collection<?> results)
195195
throws IncorrectResultSizeDataAccessException, TypeMismatchDataAccessException {

spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ModelAndViewResolverMethodReturnValueHandlerTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ public TestModelAndViewResolver(Class<?> returnValueType) {
126126

127127
@Override
128128
@SuppressWarnings("rawtypes")
129-
public ModelAndView resolveModelAndView(Method method, Class handlerType, Object returnValue,
129+
public ModelAndView resolveModelAndView(Method method, Class<?> handlerType, Object returnValue,
130130
ExtendedModelMap model, NativeWebRequest request) {
131+
131132
if (returnValue != null && returnValue.getClass().equals(returnValueType)) {
132133
return new ModelAndView("viewName", "modelAttrName", returnValue);
133134
}
@@ -137,4 +138,4 @@ public ModelAndView resolveModelAndView(Method method, Class handlerType, Object
137138
}
138139
}
139140

140-
}
141+
}

spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ServletAnnotationControllerHandlerMethodTests.java

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -106,7 +106,6 @@
106106
import org.springframework.validation.Errors;
107107
import org.springframework.validation.FieldError;
108108
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
109-
import org.springframework.web.accept.ContentNegotiationManager;
110109
import org.springframework.web.accept.ContentNegotiationManagerFactoryBean;
111110
import org.springframework.web.bind.WebDataBinder;
112111
import org.springframework.web.bind.annotation.CookieValue;
@@ -141,30 +140,23 @@
141140
import org.springframework.web.servlet.support.RequestContextUtils;
142141
import org.springframework.web.servlet.view.InternalResourceViewResolver;
143142

144-
import static org.junit.Assert.assertArrayEquals;
145-
import static org.junit.Assert.assertEquals;
146-
import static org.junit.Assert.assertFalse;
147-
import static org.junit.Assert.assertNotNull;
148-
import static org.junit.Assert.assertNull;
149-
import static org.junit.Assert.assertSame;
150-
import static org.junit.Assert.assertTrue;
151-
import static org.junit.Assert.fail;
143+
import static org.junit.Assert.*;
152144

153145
/**
154146
* The origin of this test class is {@link ServletAnnotationControllerHandlerMethodTests}.
155147
*
156148
* Tests in this class run against the {@link HandlerMethod} infrastructure:
157149
* <ul>
158-
* <li>RequestMappingHandlerMapping
159-
* <li>RequestMappingHandlerAdapter
160-
* <li>ExceptionHandlerExceptionResolver
150+
* <li>RequestMappingHandlerMapping
151+
* <li>RequestMappingHandlerAdapter
152+
* <li>ExceptionHandlerExceptionResolver
161153
* </ul>
162154
*
163155
* <p>Rather than against the existing infrastructure:
164156
* <ul>
165-
* <li>DefaultAnnotationHandlerMapping
166-
* <li>AnnotationMethodHandlerAdapter
167-
* <li>AnnotationMethodHandlerExceptionResolver
157+
* <li>DefaultAnnotationHandlerMapping
158+
* <li>AnnotationMethodHandlerAdapter
159+
* <li>AnnotationMethodHandlerExceptionResolver
168160
* </ul>
169161
*
170162
* @author Rossen Stoyanchev
@@ -2789,18 +2781,15 @@ public static class MyModelAndViewResolver implements ModelAndViewResolver {
27892781

27902782
@Override
27912783
@SuppressWarnings("rawtypes")
2792-
public ModelAndView resolveModelAndView(Method handlerMethod,
2793-
Class handlerType,
2794-
Object returnValue,
2795-
ExtendedModelMap implicitModel,
2796-
NativeWebRequest webRequest) {
2784+
public ModelAndView resolveModelAndView(Method handlerMethod, Class<?> handlerType, Object returnValue,
2785+
ExtendedModelMap implicitModel, NativeWebRequest webRequest) {
2786+
27972787
if (returnValue instanceof MySpecialArg) {
27982788
return new ModelAndView(new View() {
27992789
@Override
28002790
public String getContentType() {
28012791
return "text/html";
28022792
}
2803-
28042793
@Override
28052794
public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response)
28062795
throws Exception {

0 commit comments

Comments
 (0)