Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
8038fb9c
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8038fb9c
编写于
1月 25, 2017
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
HandlerMethod pre-resolves parameter types at construction time
Issue: SPR-15186
上级
4e65c102
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
15 deletion
+18
-15
spring-messaging/src/main/java/org/springframework/messaging/handler/HandlerMethod.java
.../org/springframework/messaging/handler/HandlerMethod.java
+9
-5
spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java
.../messaging/handler/invocation/InvocableHandlerMethod.java
+0
-2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java
...rk/web/reactive/result/method/InvocableHandlerMethod.java
+0
-1
spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java
...in/java/org/springframework/web/method/HandlerMethod.java
+9
-5
spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java
...gframework/web/method/support/InvocableHandlerMethod.java
+0
-2
未找到文件。
spring-messaging/src/main/java/org/springframework/messaging/handler/HandlerMethod.java
浏览文件 @
8038fb9c
/*
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
7
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.
...
@@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
...
@@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.core.BridgeMethodResolver
;
import
org.springframework.core.BridgeMethodResolver
;
import
org.springframework.core.GenericTypeResolver
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.annotation.AnnotatedElementUtils
;
import
org.springframework.core.annotation.AnnotatedElementUtils
;
import
org.springframework.core.annotation.SynthesizingMethodParameter
;
import
org.springframework.core.annotation.SynthesizingMethodParameter
;
...
@@ -36,9 +37,10 @@ import org.springframework.util.ClassUtils;
...
@@ -36,9 +37,10 @@ import org.springframework.util.ClassUtils;
* Provides convenient access to method parameters, the method return value,
* Provides convenient access to method parameters, the method return value,
* method annotations, etc.
* method annotations, etc.
*
*
* <p>The class may be created with a bean instance or with a bean name (e.g. lazy-init bean,
* <p>The class may be created with a bean instance or with a bean name
* prototype bean). Use {@link #createWithResolvedBean()} to obtain a {@code HandlerMethod}
* (e.g. lazy-init bean, prototype bean). Use {@link #createWithResolvedBean()}
* instance with a bean instance resolved through the associated {@link BeanFactory}.
* to obtain a {@code HandlerMethod} instance with a bean instance resolved
* through the associated {@link BeanFactory}.
*
*
* @author Arjen Poutsma
* @author Arjen Poutsma
* @author Rossen Stoyanchev
* @author Rossen Stoyanchev
...
@@ -148,7 +150,9 @@ public class HandlerMethod {
...
@@ -148,7 +150,9 @@ public class HandlerMethod {
int
count
=
this
.
bridgedMethod
.
getParameterCount
();
int
count
=
this
.
bridgedMethod
.
getParameterCount
();
MethodParameter
[]
result
=
new
MethodParameter
[
count
];
MethodParameter
[]
result
=
new
MethodParameter
[
count
];
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
result
[
i
]
=
new
HandlerMethodParameter
(
i
);
HandlerMethodParameter
parameter
=
new
HandlerMethodParameter
(
i
);
GenericTypeResolver
.
resolveParameterType
(
parameter
,
this
.
beanType
);
result
[
i
]
=
parameter
;
}
}
return
result
;
return
result
;
}
}
...
...
spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java
浏览文件 @
8038fb9c
...
@@ -22,7 +22,6 @@ import java.lang.reflect.Type;
...
@@ -22,7 +22,6 @@ import java.lang.reflect.Type;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
org.springframework.core.DefaultParameterNameDiscoverer
;
import
org.springframework.core.DefaultParameterNameDiscoverer
;
import
org.springframework.core.GenericTypeResolver
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.ParameterNameDiscoverer
;
import
org.springframework.core.ParameterNameDiscoverer
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.ResolvableType
;
...
@@ -127,7 +126,6 @@ public class InvocableHandlerMethod extends HandlerMethod {
...
@@ -127,7 +126,6 @@ public class InvocableHandlerMethod extends HandlerMethod {
for
(
int
i
=
0
;
i
<
parameters
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
parameters
.
length
;
i
++)
{
MethodParameter
parameter
=
parameters
[
i
];
MethodParameter
parameter
=
parameters
[
i
];
parameter
.
initParameterNameDiscovery
(
this
.
parameterNameDiscoverer
);
parameter
.
initParameterNameDiscovery
(
this
.
parameterNameDiscoverer
);
GenericTypeResolver
.
resolveParameterType
(
parameter
,
getBean
().
getClass
());
args
[
i
]
=
resolveProvidedArgument
(
parameter
,
providedArgs
);
args
[
i
]
=
resolveProvidedArgument
(
parameter
,
providedArgs
);
if
(
args
[
i
]
!=
null
)
{
if
(
args
[
i
]
!=
null
)
{
continue
;
continue
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java
浏览文件 @
8038fb9c
...
@@ -123,7 +123,6 @@ public class InvocableHandlerMethod extends HandlerMethod {
...
@@ -123,7 +123,6 @@ public class InvocableHandlerMethod extends HandlerMethod {
List
<
Mono
<
Object
>>
argMonos
=
Stream
.
of
(
getMethodParameters
())
List
<
Mono
<
Object
>>
argMonos
=
Stream
.
of
(
getMethodParameters
())
.
map
(
param
->
{
.
map
(
param
->
{
param
.
initParameterNameDiscovery
(
this
.
parameterNameDiscoverer
);
param
.
initParameterNameDiscovery
(
this
.
parameterNameDiscoverer
);
GenericTypeResolver
.
resolveParameterType
(
param
,
getBean
().
getClass
());
return
findProvidedArgument
(
param
,
providedArgs
)
return
findProvidedArgument
(
param
,
providedArgs
)
.
map
(
Mono:
:
just
)
.
map
(
Mono:
:
just
)
.
orElseGet
(()
->
{
.
orElseGet
(()
->
{
...
...
spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java
浏览文件 @
8038fb9c
/*
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
7
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.
...
@@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
...
@@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.core.BridgeMethodResolver
;
import
org.springframework.core.BridgeMethodResolver
;
import
org.springframework.core.GenericTypeResolver
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.annotation.AnnotatedElementUtils
;
import
org.springframework.core.annotation.AnnotatedElementUtils
;
import
org.springframework.core.annotation.SynthesizingMethodParameter
;
import
org.springframework.core.annotation.SynthesizingMethodParameter
;
...
@@ -36,9 +37,10 @@ import org.springframework.util.ClassUtils;
...
@@ -36,9 +37,10 @@ import org.springframework.util.ClassUtils;
* Provides convenient access to method parameters, the method return value,
* Provides convenient access to method parameters, the method return value,
* method annotations, etc.
* method annotations, etc.
*
*
* <p>The class may be created with a bean instance or with a bean name (e.g. lazy-init bean,
* <p>The class may be created with a bean instance or with a bean name
* prototype bean). Use {@link #createWithResolvedBean()} to obtain a {@code HandlerMethod}
* (e.g. lazy-init bean, prototype bean). Use {@link #createWithResolvedBean()}
* instance with a bean instance resolved through the associated {@link BeanFactory}.
* to obtain a {@code HandlerMethod} instance with a bean instance resolved
* through the associated {@link BeanFactory}.
*
*
* @author Arjen Poutsma
* @author Arjen Poutsma
* @author Rossen Stoyanchev
* @author Rossen Stoyanchev
...
@@ -149,7 +151,9 @@ public class HandlerMethod {
...
@@ -149,7 +151,9 @@ public class HandlerMethod {
int
count
=
this
.
bridgedMethod
.
getParameterCount
();
int
count
=
this
.
bridgedMethod
.
getParameterCount
();
MethodParameter
[]
result
=
new
MethodParameter
[
count
];
MethodParameter
[]
result
=
new
MethodParameter
[
count
];
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
result
[
i
]
=
new
HandlerMethodParameter
(
i
);
HandlerMethodParameter
parameter
=
new
HandlerMethodParameter
(
i
);
GenericTypeResolver
.
resolveParameterType
(
parameter
,
this
.
beanType
);
result
[
i
]
=
parameter
;
}
}
return
result
;
return
result
;
}
}
...
...
spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java
浏览文件 @
8038fb9c
...
@@ -21,7 +21,6 @@ import java.lang.reflect.Method;
...
@@ -21,7 +21,6 @@ import java.lang.reflect.Method;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
org.springframework.core.DefaultParameterNameDiscoverer
;
import
org.springframework.core.DefaultParameterNameDiscoverer
;
import
org.springframework.core.GenericTypeResolver
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.core.ParameterNameDiscoverer
;
import
org.springframework.core.ParameterNameDiscoverer
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ClassUtils
;
...
@@ -150,7 +149,6 @@ public class InvocableHandlerMethod extends HandlerMethod {
...
@@ -150,7 +149,6 @@ public class InvocableHandlerMethod extends HandlerMethod {
for
(
int
i
=
0
;
i
<
parameters
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
parameters
.
length
;
i
++)
{
MethodParameter
parameter
=
parameters
[
i
];
MethodParameter
parameter
=
parameters
[
i
];
parameter
.
initParameterNameDiscovery
(
this
.
parameterNameDiscoverer
);
parameter
.
initParameterNameDiscovery
(
this
.
parameterNameDiscoverer
);
GenericTypeResolver
.
resolveParameterType
(
parameter
,
getBean
().
getClass
());
args
[
i
]
=
resolveProvidedArgument
(
parameter
,
providedArgs
);
args
[
i
]
=
resolveProvidedArgument
(
parameter
,
providedArgs
);
if
(
args
[
i
]
!=
null
)
{
if
(
args
[
i
]
!=
null
)
{
continue
;
continue
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录