Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
e307dd58
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 搜索 >>
提交
e307dd58
编写于
2月 15, 2019
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
c2bd229d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
87 addition
and
81 deletion
+87
-81
spring-aop/src/main/java/org/springframework/aop/framework/ObjenesisCglibAopProxy.java
...springframework/aop/framework/ObjenesisCglibAopProxy.java
+2
-3
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractJCacheOperation.java
...ork/cache/jcache/interceptor/AbstractJCacheOperation.java
+23
-17
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/JCacheOperation.java
...ngframework/cache/jcache/interceptor/JCacheOperation.java
+5
-4
spring-context/src/main/java/org/springframework/context/ResourceLoaderAware.java
...java/org/springframework/context/ResourceLoaderAware.java
+28
-28
spring-core/src/main/java/org/springframework/core/io/support/ResourcePatternUtils.java
...springframework/core/io/support/ResourcePatternUtils.java
+5
-5
spring-expression/src/main/java/org/springframework/expression/spel/ast/CompoundExpression.java
...ringframework/expression/spel/ast/CompoundExpression.java
+3
-3
spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttribute.java
...amework/transaction/interceptor/TransactionAttribute.java
+4
-3
spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeEditor.java
...k/transaction/interceptor/TransactionAttributeEditor.java
+17
-18
未找到文件。
spring-aop/src/main/java/org/springframework/aop/framework/ObjenesisCglibAopProxy.java
浏览文件 @
e307dd58
/*
* Copyright 2002-201
6
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.
...
...
@@ -29,7 +29,7 @@ import org.springframework.util.ReflectionUtils;
/**
* Objenesis-based extension of {@link CglibAopProxy} to create proxy instances
* without invoking the constructor of the class.
* without invoking the constructor of the class.
Used by default as of Spring 4.
*
* @author Oliver Gierke
* @author Juergen Hoeller
...
...
@@ -53,7 +53,6 @@ class ObjenesisCglibAopProxy extends CglibAopProxy {
@Override
@SuppressWarnings
(
"unchecked"
)
protected
Object
createProxyClassAndInstance
(
Enhancer
enhancer
,
Callback
[]
callbacks
)
{
Class
<?>
proxyClass
=
enhancer
.
createClass
();
Object
proxyInstance
=
null
;
...
...
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractJCacheOperation.java
浏览文件 @
e307dd58
/*
* 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.
...
...
@@ -62,12 +62,15 @@ abstract class AbstractJCacheOperation<A extends Annotation> implements JCacheOp
this
.
allParameterDetails
=
initializeAllParameterDetails
(
methodDetails
.
getMethod
());
}
/**
* Return the {@link ExceptionTypeFilter} to use to filter exceptions thrown while
* invoking the method.
*/
public
abstract
ExceptionTypeFilter
getExceptionTypeFilter
();
private
static
List
<
CacheParameterDetail
>
initializeAllParameterDetails
(
Method
method
)
{
int
parameterCount
=
method
.
getParameterCount
();
List
<
CacheParameterDetail
>
result
=
new
ArrayList
<>(
parameterCount
);
for
(
int
i
=
0
;
i
<
parameterCount
;
i
++)
{
CacheParameterDetail
detail
=
new
CacheParameterDetail
(
method
,
i
);
result
.
add
(
detail
);
}
return
result
;
}
@Override
...
...
@@ -113,12 +116,25 @@ abstract class AbstractJCacheOperation<A extends Annotation> implements JCacheOp
return
result
.
toArray
(
new
CacheInvocationParameter
[
0
]);
}
/**
* Return the {@link ExceptionTypeFilter} to use to filter exceptions thrown while
* invoking the method.
* @see #createExceptionTypeFilter
*/
public
abstract
ExceptionTypeFilter
getExceptionTypeFilter
();
/**
* Convenience method for subclasses to create a specific {@code ExceptionTypeFilter}.
* @see #getExceptionTypeFilter()
*/
protected
ExceptionTypeFilter
createExceptionTypeFilter
(
Class
<?
extends
Throwable
>[]
includes
,
Class
<?
extends
Throwable
>[]
excludes
)
{
return
new
ExceptionTypeFilter
(
Arrays
.
asList
(
includes
),
Arrays
.
asList
(
excludes
),
true
);
}
@Override
public
String
toString
()
{
return
getOperationDescription
().
append
(
"]"
).
toString
();
...
...
@@ -137,16 +153,6 @@ abstract class AbstractJCacheOperation<A extends Annotation> implements JCacheOp
}
private
static
List
<
CacheParameterDetail
>
initializeAllParameterDetails
(
Method
method
)
{
List
<
CacheParameterDetail
>
result
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
method
.
getParameterCount
();
i
++)
{
CacheParameterDetail
detail
=
new
CacheParameterDetail
(
method
,
i
);
result
.
add
(
detail
);
}
return
result
;
}
/**
* Details for a single cache parameter.
*/
...
...
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/JCacheOperation.java
浏览文件 @
e307dd58
/*
* 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.
...
...
@@ -24,9 +24,10 @@ import org.springframework.cache.interceptor.BasicOperation;
import
org.springframework.cache.interceptor.CacheResolver
;
/**
* Model the base of JSR-107 cache operation.
* <p>A cache operation can be statically cached as it does not contain
* any runtime operation of a specific cache invocation.
* Model the base of JSR-107 cache operation through an interface contract.
*
* <p>A cache operation can be statically cached as it does not contain any
* runtime operation of a specific cache invocation.
*
* @author Stephane Nicoll
* @since 4.1
...
...
spring-context/src/main/java/org/springframework/context/ResourceLoaderAware.java
浏览文件 @
e307dd58
/*
* 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.
...
...
@@ -20,44 +20,44 @@ import org.springframework.beans.factory.Aware;
import
org.springframework.core.io.ResourceLoader
;
/**
* Interface to be implemented by any object that wishes to be notified of
*
the <b>ResourceLoader</b>
(typically the ApplicationContext) that it runs in.
* This is an alternative to a full
ApplicationContext dependency via the
*
ApplicationContextAware
interface.
* Interface to be implemented by any object that wishes to be notified of
the
*
{@link ResourceLoader}
(typically the ApplicationContext) that it runs in.
* This is an alternative to a full
{@link ApplicationContext} dependency via
*
the {@link org.springframework.context.ApplicationContextAware}
interface.
*
* <p>Note that Resource dependencies can also be exposed as bean properties
* of type Resource, populated via Strings with automatic type conversion by
* the bean factory. This removes the need for implementing any callback
* interface just for the purpose of accessing a specific file resource.
* <p>Note that {@link org.springframework.core.io.Resource} dependencies can also
* be exposed as bean properties of type {@code Resource}, populated via Strings
* with automatic type conversion by the bean factory. This removes the need for
* implementing any callback interface just for the purpose of accessing a
* specific file resource.
*
* <p>You typically need a ResourceLoader when your application object has
* to access a variety of file resources whose names are calculated. A good
* strategy is to make the object use a DefaultResourceLoader but still
* implement ResourceLoaderAware to allow for overriding when running in an
* ApplicationContext. See ReloadableResourceBundleMessageSource for an example.
* <p>You typically need a {@link ResourceLoader} when your application object has to
* access a variety of file resources whose names are calculated. A good strategy is
* to make the object use a {@link org.springframework.core.io.DefaultResourceLoader}
* but still implement {@code ResourceLoaderAware} to allow for overriding when
* running in an {@code ApplicationContext}. See
* {@link org.springframework.context.support.ReloadableResourceBundleMessageSource}
* for an example.
*
* <p>A passed-in ResourceLoader can also be checked for the
* <b>ResourcePatternResolver</b> interface and cast accordingly, to be able
* to resolve resource patterns into arrays of Resource objects. This will always
* work when running in an ApplicationContext (the context interface extends
* ResourcePatternResolver). Use a PathMatchingResourcePatternResolver as default.
* See also the {@code ResourcePatternUtils.getResourcePatternResolver} method.
* <p>A passed-in {@code ResourceLoader} can also be checked for the
* {@link org.springframework.core.io.support.ResourcePatternResolver} interface
* and cast accordingly, in order to resolve resource patterns into arrays of
* {@code Resource} objects. This will always work when running in an ApplicationContext
* (since the context interface extends the ResourcePatternResolver interface). Use a
* {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver} as
* default; see also the {@code ResourcePatternUtils.getResourcePatternResolver} method.
*
* <p>As a
lternative to a ResourcePatternResolver dependency, consider exposing
*
bean properties of type Resource array, populated via pattern Strings with
*
automatic type conversion by the bean factory
.
* <p>As a
n alternative to a {@code ResourcePatternResolver} dependency, consider
*
exposing bean properties of type {@code Resource} array, populated via pattern
*
Strings with automatic type conversion by the bean factory at binding time
.
*
* @author Juergen Hoeller
* @author Chris Beams
* @since 10.03.2004
* @see ApplicationContextAware
* @see org.springframework.beans.factory.InitializingBean
* @see org.springframework.core.io.Resource
* @see org.springframework.core.io.ResourceLoader
* @see org.springframework.core.io.support.ResourcePatternResolver
* @see org.springframework.core.io.support.ResourcePatternUtils#getResourcePatternResolver
* @see org.springframework.core.io.DefaultResourceLoader
* @see org.springframework.core.io.support.PathMatchingResourcePatternResolver
* @see org.springframework.context.support.ReloadableResourceBundleMessageSource
*/
public
interface
ResourceLoaderAware
extends
Aware
{
...
...
spring-core/src/main/java/org/springframework/core/io/support/ResourcePatternUtils.java
浏览文件 @
e307dd58
/*
* 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.
...
...
@@ -49,10 +49,10 @@ public abstract class ResourcePatternUtils {
}
/**
* Return a default
ResourcePatternResolver for the given ResourceLoader
.
* <p>This might be the
ResourceLoader
itself, if it implements the
*
ResourcePatternResolver extension, or a PathMatchingResourcePatternResolver
*
built on the given ResourceLoader
.
* Return a default
{@link ResourcePatternResolver} for the given {@link ResourceLoader}
.
* <p>This might be the
{@code ResourceLoader}
itself, if it implements the
*
{@code ResourcePatternResolver} extension, or a default
*
{@link PathMatchingResourcePatternResolver} built on the given {@code ResourceLoader}
.
* @param resourceLoader the ResourceLoader to build a pattern resolver for
* (may be {@code null} to indicate a default ResourceLoader)
* @return the ResourcePatternResolver
...
...
spring-expression/src/main/java/org/springframework/expression/spel/ast/CompoundExpression.java
浏览文件 @
e307dd58
/*
* 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.
...
...
@@ -126,8 +126,8 @@ public class CompoundExpression extends SpelNodeImpl {
@Override
public
void
generateCode
(
MethodVisitor
mv
,
CodeFlow
cf
)
{
for
(
int
i
=
0
;
i
<
this
.
children
.
length
;
i
++
)
{
this
.
children
[
i
]
.
generateCode
(
mv
,
cf
);
for
(
SpelNodeImpl
child
:
this
.
children
)
{
child
.
generateCode
(
mv
,
cf
);
}
cf
.
pushDescriptor
(
this
.
exitTypeDescriptor
);
}
...
...
spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttribute.java
浏览文件 @
e307dd58
/*
* 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.
...
...
@@ -21,8 +21,8 @@ import org.springframework.transaction.TransactionDefinition;
/**
* This interface adds a {@code rollbackOn} specification to {@link TransactionDefinition}.
* As custom {@code rollbackOn} is only possible with AOP,
this class resides
*
in the AOP transaction
package.
* As custom {@code rollbackOn} is only possible with AOP,
it resides in the AOP-related
*
transaction sub
package.
*
* @author Rod Johnson
* @author Juergen Hoeller
...
...
@@ -36,6 +36,7 @@ public interface TransactionAttribute extends TransactionDefinition {
* Return a qualifier value associated with this transaction attribute.
* <p>This may be used for choosing a corresponding transaction manager
* to process this specific transaction.
* @since 3.0
*/
@Nullable
String
getQualifier
();
...
...
spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAttributeEditor.java
浏览文件 @
e307dd58
/*
* Copyright 2002-201
2
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.
...
...
@@ -45,7 +45,6 @@ public class TransactionAttributeEditor extends PropertyEditorSupport {
/**
* Format is PROPAGATION_NAME,ISOLATION_NAME,readOnly,timeout_NNNN,+Exception1,-Exception2.
* Null or the empty string means that the method is non transactional.
* @see java.beans.PropertyEditor#setAsText(java.lang.String)
*/
@Override
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
...
...
@@ -53,36 +52,36 @@ public class TransactionAttributeEditor extends PropertyEditorSupport {
// tokenize it with ","
String
[]
tokens
=
StringUtils
.
commaDelimitedListToStringArray
(
text
);
RuleBasedTransactionAttribute
attr
=
new
RuleBasedTransactionAttribute
();
for
(
int
i
=
0
;
i
<
tokens
.
length
;
i
++
)
{
for
(
String
token
:
tokens
)
{
// Trim leading and trailing whitespace.
String
t
oken
=
StringUtils
.
trimWhitespace
(
tokens
[
i
]
.
trim
());
String
t
rimmedToken
=
StringUtils
.
trimWhitespace
(
token
.
trim
());
// Check whether token contains illegal whitespace within text.
if
(
StringUtils
.
containsWhitespace
(
token
))
{
if
(
StringUtils
.
containsWhitespace
(
t
rimmedT
oken
))
{
throw
new
IllegalArgumentException
(
"Transaction attribute token contains illegal whitespace: ["
+
token
+
"]"
);
"Transaction attribute token contains illegal whitespace: ["
+
t
rimmedT
oken
+
"]"
);
}
// Check token type.
if
(
token
.
startsWith
(
RuleBasedTransactionAttribute
.
PREFIX_PROPAGATION
))
{
attr
.
setPropagationBehaviorName
(
token
);
if
(
t
rimmedT
oken
.
startsWith
(
RuleBasedTransactionAttribute
.
PREFIX_PROPAGATION
))
{
attr
.
setPropagationBehaviorName
(
t
rimmedT
oken
);
}
else
if
(
token
.
startsWith
(
RuleBasedTransactionAttribute
.
PREFIX_ISOLATION
))
{
attr
.
setIsolationLevelName
(
token
);
else
if
(
t
rimmedT
oken
.
startsWith
(
RuleBasedTransactionAttribute
.
PREFIX_ISOLATION
))
{
attr
.
setIsolationLevelName
(
t
rimmedT
oken
);
}
else
if
(
token
.
startsWith
(
RuleBasedTransactionAttribute
.
PREFIX_TIMEOUT
))
{
String
value
=
token
.
substring
(
DefaultTransactionAttribute
.
PREFIX_TIMEOUT
.
length
());
else
if
(
t
rimmedT
oken
.
startsWith
(
RuleBasedTransactionAttribute
.
PREFIX_TIMEOUT
))
{
String
value
=
t
rimmedT
oken
.
substring
(
DefaultTransactionAttribute
.
PREFIX_TIMEOUT
.
length
());
attr
.
setTimeout
(
Integer
.
parseInt
(
value
));
}
else
if
(
token
.
equals
(
RuleBasedTransactionAttribute
.
READ_ONLY_MARKER
))
{
else
if
(
t
rimmedT
oken
.
equals
(
RuleBasedTransactionAttribute
.
READ_ONLY_MARKER
))
{
attr
.
setReadOnly
(
true
);
}
else
if
(
token
.
startsWith
(
RuleBasedTransactionAttribute
.
PREFIX_COMMIT_RULE
))
{
attr
.
getRollbackRules
().
add
(
new
NoRollbackRuleAttribute
(
token
.
substring
(
1
)));
else
if
(
t
rimmedT
oken
.
startsWith
(
RuleBasedTransactionAttribute
.
PREFIX_COMMIT_RULE
))
{
attr
.
getRollbackRules
().
add
(
new
NoRollbackRuleAttribute
(
t
rimmedT
oken
.
substring
(
1
)));
}
else
if
(
token
.
startsWith
(
RuleBasedTransactionAttribute
.
PREFIX_ROLLBACK_RULE
))
{
attr
.
getRollbackRules
().
add
(
new
RollbackRuleAttribute
(
token
.
substring
(
1
)));
else
if
(
t
rimmedT
oken
.
startsWith
(
RuleBasedTransactionAttribute
.
PREFIX_ROLLBACK_RULE
))
{
attr
.
getRollbackRules
().
add
(
new
RollbackRuleAttribute
(
t
rimmedT
oken
.
substring
(
1
)));
}
else
{
throw
new
IllegalArgumentException
(
"Invalid transaction attribute token: ["
+
token
+
"]"
);
throw
new
IllegalArgumentException
(
"Invalid transaction attribute token: ["
+
t
rimmedT
oken
+
"]"
);
}
}
setValue
(
attr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录