Polishing
This commit is contained in:
parent
3bc27e8d14
commit
48934cba1b
|
@ -64,7 +64,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||||
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setup() {
|
||||||
this.oldRequestAttributes = new ServletRequestAttributes(new MockHttpServletRequest());
|
this.oldRequestAttributes = new ServletRequestAttributes(new MockHttpServletRequest());
|
||||||
this.newRequestAttributes = new ServletRequestAttributes(new MockHttpServletRequest());
|
this.newRequestAttributes = new ServletRequestAttributes(new MockHttpServletRequest());
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void tearDown() throws Exception {
|
void reset() {
|
||||||
RequestContextHolder.setRequestAttributes(null);
|
RequestContextHolder.setRequestAttributes(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||||
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setup() {
|
||||||
MockHttpServletRequest oldRequestWithSession = new MockHttpServletRequest();
|
MockHttpServletRequest oldRequestWithSession = new MockHttpServletRequest();
|
||||||
oldRequestWithSession.setSession(new MockHttpSession());
|
oldRequestWithSession.setSession(new MockHttpSession());
|
||||||
this.oldRequestAttributesWithSession = new ServletRequestAttributes(oldRequestWithSession);
|
this.oldRequestAttributesWithSession = new ServletRequestAttributes(oldRequestWithSession);
|
||||||
|
@ -69,7 +69,7 @@ class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void tearDown() throws Exception {
|
void reset() {
|
||||||
RequestContextHolder.resetRequestAttributes();
|
RequestContextHolder.resetRequestAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -705,8 +705,8 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
||||||
}
|
}
|
||||||
|
|
||||||
private GroovyDynamicElementReader createDynamicElementReader(String namespace) {
|
private GroovyDynamicElementReader createDynamicElementReader(String namespace) {
|
||||||
XmlReaderContext readerContext = this.groovyDslXmlBeanDefinitionReader.createReaderContext(new DescriptiveResource(
|
XmlReaderContext readerContext = this.groovyDslXmlBeanDefinitionReader.createReaderContext(
|
||||||
"Groovy"));
|
new DescriptiveResource("Groovy"));
|
||||||
BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegate(readerContext);
|
BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegate(readerContext);
|
||||||
boolean decorating = (this.currentBeanDefinition != null);
|
boolean decorating = (this.currentBeanDefinition != null);
|
||||||
if (!decorating) {
|
if (!decorating) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class LookupAnnotationTests {
|
||||||
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setup() {
|
||||||
beanFactory = new DefaultListableBeanFactory();
|
beanFactory = new DefaultListableBeanFactory();
|
||||||
AutowiredAnnotationBeanPostProcessor aabpp = new AutowiredAnnotationBeanPostProcessor();
|
AutowiredAnnotationBeanPostProcessor aabpp = new AutowiredAnnotationBeanPostProcessor();
|
||||||
aabpp.setBeanFactory(beanFactory);
|
aabpp.setBeanFactory(beanFactory);
|
||||||
|
@ -122,6 +122,7 @@ public class LookupAnnotationTests {
|
||||||
@Lookup
|
@Lookup
|
||||||
public abstract TestBean getTwoArguments(String name, int age);
|
public abstract TestBean getTwoArguments(String name, int age);
|
||||||
|
|
||||||
|
// no @Lookup annotation
|
||||||
public abstract TestBean getThreeArguments(String name, int age, int anotherArg);
|
public abstract TestBean getThreeArguments(String name, int age, int anotherArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,7 @@ import org.springframework.web.server.ServerWebExchange;
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
public class ViewResolutionResultHandler extends HandlerResultHandlerSupport
|
public class ViewResolutionResultHandler extends HandlerResultHandlerSupport implements HandlerResultHandler, Ordered {
|
||||||
implements HandlerResultHandler, Ordered {
|
|
||||||
|
|
||||||
private static final Object NO_VALUE = new Object();
|
private static final Object NO_VALUE = new Object();
|
||||||
|
|
||||||
|
@ -145,6 +144,7 @@ public class ViewResolutionResultHandler extends HandlerResultHandlerSupport
|
||||||
return this.defaultViews;
|
return this.defaultViews;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(HandlerResult result) {
|
public boolean supports(HandlerResult result) {
|
||||||
if (hasModelAnnotation(result.getReturnTypeSource())) {
|
if (hasModelAnnotation(result.getReturnTypeSource())) {
|
||||||
|
@ -162,14 +162,10 @@ public class ViewResolutionResultHandler extends HandlerResultHandlerSupport
|
||||||
|
|
||||||
return (CharSequence.class.isAssignableFrom(type) || Rendering.class.isAssignableFrom(type) ||
|
return (CharSequence.class.isAssignableFrom(type) || Rendering.class.isAssignableFrom(type) ||
|
||||||
Model.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type) ||
|
Model.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type) ||
|
||||||
Void.class.equals(type) || void.class.equals(type) || View.class.isAssignableFrom(type) ||
|
void.class == type || Void.class == type || View.class.isAssignableFrom(type) ||
|
||||||
!BeanUtils.isSimpleProperty(type));
|
!BeanUtils.isSimpleProperty(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasModelAnnotation(MethodParameter parameter) {
|
|
||||||
return parameter.hasMethodAnnotation(ModelAttribute.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Mono<Void> handleResult(ServerWebExchange exchange, HandlerResult result) {
|
public Mono<Void> handleResult(ServerWebExchange exchange, HandlerResult result) {
|
||||||
|
@ -251,6 +247,11 @@ public class ViewResolutionResultHandler extends HandlerResultHandlerSupport
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean hasModelAnnotation(MethodParameter parameter) {
|
||||||
|
return parameter.hasMethodAnnotation(ModelAttribute.class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select a default view name when a controller did not specify it.
|
* Select a default view name when a controller did not specify it.
|
||||||
* Use the request path the leading and trailing slash stripped.
|
* Use the request path the leading and trailing slash stripped.
|
||||||
|
|
Loading…
Reference in New Issue