Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
c192c14a
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,体验更适合开发者的 AI 搜索 >>
提交
c192c14a
编写于
3月 26, 2019
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
d397d74e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
23 deletion
+31
-23
spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java
...springframework/beans/annotation/AnnotationBeanUtils.java
+7
-3
spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java
.../springframework/beans/factory/support/AutowireUtils.java
+1
-1
spring-beans/src/test/java/org/springframework/beans/factory/support/AutowireUtilsTests.java
...ngframework/beans/factory/support/AutowireUtilsTests.java
+4
-2
spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java
.../org/springframework/core/annotation/AnnotationUtils.java
+10
-10
spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityDecoder.java
.../springframework/web/util/HtmlCharacterEntityDecoder.java
+6
-4
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java
...mvc/method/annotation/ResponseEntityExceptionHandler.java
+3
-3
未找到文件。
spring-beans/src/main/java/org/springframework/beans/annotation/AnnotationBeanUtils.java
浏览文件 @
c192c14a
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -19,6 +19,7 @@ package org.springframework.beans.annotation;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Method
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.Set
;
...
...
@@ -58,8 +59,11 @@ public abstract class AnnotationBeanUtils {
* @param excludedProperties the names of excluded properties, if any
* @see org.springframework.beans.BeanWrapper
*/
public
static
void
copyPropertiesToBean
(
Annotation
ann
,
Object
bean
,
StringValueResolver
valueResolver
,
String
...
excludedProperties
)
{
Set
<
String
>
excluded
=
new
HashSet
<
String
>(
Arrays
.
asList
(
excludedProperties
));
public
static
void
copyPropertiesToBean
(
Annotation
ann
,
Object
bean
,
StringValueResolver
valueResolver
,
String
...
excludedProperties
)
{
Set
<
String
>
excluded
=
(
excludedProperties
.
length
==
0
?
Collections
.<
String
>
emptySet
()
:
new
HashSet
<
String
>(
Arrays
.
asList
(
excludedProperties
)));
Method
[]
annotationProperties
=
ann
.
annotationType
().
getDeclaredMethods
();
BeanWrapper
bw
=
PropertyAccessorFactory
.
forBeanPropertyAccess
(
bean
);
for
(
Method
annotationProperty
:
annotationProperties
)
{
...
...
spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java
浏览文件 @
c192c14a
...
...
@@ -278,7 +278,7 @@ abstract class AutowireUtils {
/**
* Reflective
InvocationHandler
for lazy access to the current target object.
* Reflective
{@link InvocationHandler}
for lazy access to the current target object.
*/
@SuppressWarnings
(
"serial"
)
private
static
class
ObjectFactoryDelegatingInvocationHandler
implements
InvocationHandler
,
Serializable
{
...
...
spring-beans/src/test/java/org/springframework/beans/factory/support/AutowireUtilsTests.java
浏览文件 @
c192c14a
/*
* Copyright 2002-201
8
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -27,6 +27,8 @@ import org.springframework.util.ReflectionUtils;
import
static
org
.
junit
.
Assert
.*;
/**
* Unit tests for {@link AutowireUtils}.
*
* @author Juergen Hoeller
* @author Sam Brannen
*/
...
...
@@ -36,7 +38,7 @@ public class AutowireUtilsTests {
public
void
genericMethodReturnTypes
()
{
Method
notParameterized
=
ReflectionUtils
.
findMethod
(
MyTypeWithMethods
.
class
,
"notParameterized"
);
assertEquals
(
String
.
class
,
AutowireUtils
.
resolveReturnTypeForFactoryMethod
(
notParameterized
,
new
Object
[
]{}
,
getClass
().
getClassLoader
()));
AutowireUtils
.
resolveReturnTypeForFactoryMethod
(
notParameterized
,
new
Object
[
0
]
,
getClass
().
getClassLoader
()));
Method
notParameterizedWithArguments
=
ReflectionUtils
.
findMethod
(
MyTypeWithMethods
.
class
,
"notParameterizedWithArguments"
,
Integer
.
class
,
Boolean
.
class
);
assertEquals
(
String
.
class
,
...
...
spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java
浏览文件 @
c192c14a
/*
* Copyright 2002-201
8
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -51,14 +51,14 @@ import org.springframework.util.StringUtils;
* <p>Note that most of the features of this class are not provided by the
* JDK's introspection facilities themselves.
*
* <p>As a general rule for runtime-retained a
nnotations (e.g. for transaction
*
control, authorization, or service exposure), always use the lookup methods
*
on this class (e.g., {@link #findAnnotation(Method, Class)},
* {@link #getAnnotation(Method, Class)}
, and {@link #getAnnotations(Method)})
*
instead of the plain annotation lookup methods in the JDK. You can still
*
explicitly choose between a <em>get</em> lookup on the given class level only
*
({@link #getAnnotation(Method, Class)}) and a <em>find</em> lookup in the entire
*
inheritance hierarchy of the given
method ({@link #findAnnotation(Method, Class)}).
* <p>As a general rule for runtime-retained a
pplication annotations (e.g. for
*
transaction control, authorization, or service exposure), always use the
*
lookup methods on this class (e.g. {@link #findAnnotation(Method, Class)} or
* {@link #getAnnotation(Method, Class)}
) instead of the plain annotation lookup
*
methods in the JDK. You can still explicitly choose between a <em>get</em>
*
lookup on the given class level only ({@link #getAnnotation(Method, Class)})
*
and a <em>find</em> lookup in the entire inheritance hierarchy of the given
* method ({@link #findAnnotation(Method, Class)}).
*
* <h3>Terminology</h3>
* The terms <em>directly present</em>, <em>indirectly present</em>, and
...
...
@@ -542,7 +542,7 @@ public abstract class AnnotationUtils {
/**
* Find a single {@link Annotation} of {@code annotationType} on the supplied
* {@link Method}, traversing its super methods (i.e.
,
from superclasses and
* {@link Method}, traversing its super methods (i.e. from superclasses and
* interfaces) if the annotation is not <em>directly present</em> on the given
* method itself.
* <p>Correctly handles bridge {@link Method Methods} generated by the compiler.
...
...
spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityDecoder.java
浏览文件 @
c192c14a
/*
* Copyright 2002-201
7
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -66,8 +66,9 @@ class HtmlCharacterEntityDecoder {
this
.
originalMessage
.
indexOf
(
'&'
,
this
.
nextPotentialReferencePosition
);
if
(
this
.
nextSemicolonPosition
!=
-
1
&&
this
.
nextSemicolonPosition
<
this
.
nextPotentialReferencePosition
)
this
.
nextSemicolonPosition
<
this
.
nextPotentialReferencePosition
)
{
this
.
nextSemicolonPosition
=
this
.
originalMessage
.
indexOf
(
';'
,
this
.
nextPotentialReferencePosition
+
1
);
}
boolean
isPotentialReference
=
(
this
.
nextPotentialReferencePosition
!=
-
1
&&
this
.
nextSemicolonPosition
!=
-
1
&&
...
...
@@ -94,12 +95,13 @@ class HtmlCharacterEntityDecoder {
int
skipUntilIndex
=
(
this
.
nextPotentialReferencePosition
!=
-
1
?
this
.
nextPotentialReferencePosition
:
this
.
originalMessage
.
length
());
if
(
skipUntilIndex
-
this
.
currentPosition
>
3
)
{
this
.
decodedMessage
.
append
(
this
.
originalMessage
.
substring
(
this
.
currentPosition
,
skipUntilIndex
)
);
this
.
decodedMessage
.
append
(
this
.
originalMessage
,
this
.
currentPosition
,
skipUntilIndex
);
this
.
currentPosition
=
skipUntilIndex
;
}
else
{
while
(
this
.
currentPosition
<
skipUntilIndex
)
while
(
this
.
currentPosition
<
skipUntilIndex
)
{
this
.
decodedMessage
.
append
(
this
.
originalMessage
.
charAt
(
this
.
currentPosition
++));
}
}
}
}
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java
浏览文件 @
c192c14a
/*
* Copyright 2002-201
8
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -442,7 +442,7 @@ public abstract class ResponseEntityExceptionHandler {
}
/**
* Customize the response for
NoHandlerFound
Exception.
* Customize the response for
AsyncRequestTimeout
Exception.
* <p>This method delegates to {@link #handleExceptionInternal}.
* @param ex the exception
* @param headers the headers to be written to the response
...
...
@@ -470,7 +470,7 @@ public abstract class ResponseEntityExceptionHandler {
}
/**
* A single place to customize the response body of all
E
xception types.
* A single place to customize the response body of all
e
xception types.
* <p>The default implementation sets the {@link WebUtils#ERROR_EXCEPTION_ATTRIBUTE}
* request attribute and creates a {@link ResponseEntity} from the given
* body, headers, and status.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录