Skip to content

Commit 48934cb

Browse files
committed
Polishing
1 parent 3bc27e8 commit 48934cb

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

integration-tests/src/test/java/org/springframework/context/annotation/jsr330/ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
6464

6565

6666
@BeforeEach
67-
void setUp() {
67+
void setup() {
6868
this.oldRequestAttributes = new ServletRequestAttributes(new MockHttpServletRequest());
6969
this.newRequestAttributes = new ServletRequestAttributes(new MockHttpServletRequest());
7070

@@ -78,7 +78,7 @@ void setUp() {
7878
}
7979

8080
@AfterEach
81-
void tearDown() throws Exception {
81+
void reset() {
8282
RequestContextHolder.setRequestAttributes(null);
8383
}
8484

integration-tests/src/test/java/org/springframework/context/annotation/scope/ClassPathBeanDefinitionScannerScopeIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
5858

5959

6060
@BeforeEach
61-
void setUp() {
61+
void setup() {
6262
MockHttpServletRequest oldRequestWithSession = new MockHttpServletRequest();
6363
oldRequestWithSession.setSession(new MockHttpSession());
6464
this.oldRequestAttributesWithSession = new ServletRequestAttributes(oldRequestWithSession);
@@ -69,7 +69,7 @@ void setUp() {
6969
}
7070

7171
@AfterEach
72-
void tearDown() throws Exception {
72+
void reset() {
7373
RequestContextHolder.resetRequestAttributes();
7474
}
7575

spring-beans/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 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.
@@ -705,8 +705,8 @@ else if (this.currentBeanDefinition != null) {
705705
}
706706

707707
private GroovyDynamicElementReader createDynamicElementReader(String namespace) {
708-
XmlReaderContext readerContext = this.groovyDslXmlBeanDefinitionReader.createReaderContext(new DescriptiveResource(
709-
"Groovy"));
708+
XmlReaderContext readerContext = this.groovyDslXmlBeanDefinitionReader.createReaderContext(
709+
new DescriptiveResource("Groovy"));
710710
BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegate(readerContext);
711711
boolean decorating = (this.currentBeanDefinition != null);
712712
if (!decorating) {

spring-beans/src/test/java/org/springframework/beans/factory/annotation/LookupAnnotationTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class LookupAnnotationTests {
3636

3737

3838
@BeforeEach
39-
public void setUp() {
39+
public void setup() {
4040
beanFactory = new DefaultListableBeanFactory();
4141
AutowiredAnnotationBeanPostProcessor aabpp = new AutowiredAnnotationBeanPostProcessor();
4242
aabpp.setBeanFactory(beanFactory);
@@ -122,6 +122,7 @@ public static abstract class AbstractBean {
122122
@Lookup
123123
public abstract TestBean getTwoArguments(String name, int age);
124124

125+
// no @Lookup annotation
125126
public abstract TestBean getThreeArguments(String name, int age, int anotherArg);
126127
}
127128

spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@
8181
* @author Rossen Stoyanchev
8282
* @since 5.0
8383
*/
84-
public class ViewResolutionResultHandler extends HandlerResultHandlerSupport
85-
implements HandlerResultHandler, Ordered {
84+
public class ViewResolutionResultHandler extends HandlerResultHandlerSupport implements HandlerResultHandler, Ordered {
8685

8786
private static final Object NO_VALUE = new Object();
8887

@@ -145,6 +144,7 @@ public List<View> getDefaultViews() {
145144
return this.defaultViews;
146145
}
147146

147+
148148
@Override
149149
public boolean supports(HandlerResult result) {
150150
if (hasModelAnnotation(result.getReturnTypeSource())) {
@@ -162,14 +162,10 @@ public boolean supports(HandlerResult result) {
162162

163163
return (CharSequence.class.isAssignableFrom(type) || Rendering.class.isAssignableFrom(type) ||
164164
Model.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type) ||
165-
Void.class.equals(type) || void.class.equals(type) || View.class.isAssignableFrom(type) ||
165+
void.class == type || Void.class == type || View.class.isAssignableFrom(type) ||
166166
!BeanUtils.isSimpleProperty(type));
167167
}
168168

169-
private boolean hasModelAnnotation(MethodParameter parameter) {
170-
return parameter.hasMethodAnnotation(ModelAttribute.class);
171-
}
172-
173169
@Override
174170
@SuppressWarnings("unchecked")
175171
public Mono<Void> handleResult(ServerWebExchange exchange, HandlerResult result) {
@@ -251,6 +247,11 @@ else if (View.class.isAssignableFrom(clazz)) {
251247
});
252248
}
253249

250+
251+
private boolean hasModelAnnotation(MethodParameter parameter) {
252+
return parameter.hasMethodAnnotation(ModelAttribute.class);
253+
}
254+
254255
/**
255256
* Select a default view name when a controller did not specify it.
256257
* Use the request path the leading and trailing slash stripped.

0 commit comments

Comments
 (0)