Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
ce916206
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 搜索 >>
提交
ce916206
编写于
5月 02, 2019
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '5.1.x'
上级
8a57997d
f359c117
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
104 addition
and
99 deletion
+104
-99
spring-beans/src/main/java/org/springframework/beans/factory/config/InstantiationAwareBeanPostProcessor.java
...s/factory/config/InstantiationAwareBeanPostProcessor.java
+6
-4
spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java
...ava/org/springframework/expression/spel/ast/Operator.java
+22
-22
spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java
...amework/expression/spel/SpelCompilationCoverageTests.java
+65
-65
spring-tx/src/main/java/org/springframework/transaction/annotation/Propagation.java
...g/springframework/transaction/annotation/Propagation.java
+3
-3
spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java
...ansaction/support/AbstractPlatformTransactionManager.java
+4
-2
spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java
...ransaction/support/TransactionSynchronizationManager.java
+4
-3
未找到文件。
spring-beans/src/main/java/org/springframework/beans/factory/config/InstantiationAwareBeanPostProcessor.java
浏览文件 @
ce916206
/*
* 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.
...
...
@@ -54,8 +54,9 @@ public interface InstantiationAwareBeanPostProcessor extends BeanPostProcessor {
* will be short-circuited. The only further processing applied is the
* {@link #postProcessAfterInitialization} callback from the configured
* {@link BeanPostProcessor BeanPostProcessors}.
* <p>This callback will only be applied to bean definitions with a bean class.
* In particular, it will not be applied to beans with a factory method.
* <p>This callback will be applied to bean definitions with their bean class,
* as well as to factory-method definitions in which case the returned bean type
* will be passed in here.
* <p>Post-processors may implement the extended
* {@link SmartInstantiationAwareBeanPostProcessor} interface in order
* to predict the type of the bean object that they are going to return here.
...
...
@@ -66,7 +67,8 @@ public interface InstantiationAwareBeanPostProcessor extends BeanPostProcessor {
* or {@code null} to proceed with default instantiation
* @throws org.springframework.beans.BeansException in case of errors
* @see #postProcessAfterInstantiation
* @see org.springframework.beans.factory.support.AbstractBeanDefinition#hasBeanClass
* @see org.springframework.beans.factory.support.AbstractBeanDefinition#getBeanClass()
* @see org.springframework.beans.factory.support.AbstractBeanDefinition#getFactoryMethodName()
*/
@Nullable
default
Object
postProcessBeforeInstantiation
(
Class
<?>
beanClass
,
String
beanName
)
throws
BeansException
{
...
...
spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java
浏览文件 @
ce916206
...
...
@@ -140,68 +140,68 @@ public abstract class Operator extends SpelNodeImpl {
// This code block checks whether the left or right operand is null and handles
// those cases before letting the original code (that only handled actual numbers) run
Label
rightIsNonNull
=
new
Label
();
mv
.
visitInsn
(
DUP
);
// stack: left/right/right
mv
.
visitJumpInsn
(
IFNONNULL
,
rightIsNonNull
);
// stack: left/right
mv
.
visitInsn
(
DUP
);
// stack: left/right/right
mv
.
visitJumpInsn
(
IFNONNULL
,
rightIsNonNull
);
// stack: left/right
// here: RIGHT==null LEFT==unknown
mv
.
visitInsn
(
SWAP
);
// right/left
mv
.
visitInsn
(
SWAP
);
// right/left
Label
leftNotNullRightIsNull
=
new
Label
();
mv
.
visitJumpInsn
(
IFNONNULL
,
leftNotNullRightIsNull
);
// stack: right
mv
.
visitJumpInsn
(
IFNONNULL
,
leftNotNullRightIsNull
);
// stack: right
// here: RIGHT==null LEFT==null
mv
.
visitInsn
(
POP
);
// stack: <nothing>
mv
.
visitInsn
(
POP
);
// stack: <nothing>
// load 0 or 1 depending on comparison instruction
switch
(
compInstruction1
)
{
case
IFGE:
// OpLT
case
IFLE:
// OpGT
mv
.
visitInsn
(
ICONST_0
);
// false - null is not < or > null
mv
.
visitInsn
(
ICONST_0
);
// false - null is not < or > null
break
;
case
IFGT:
// OpLE
case
IFLT:
// OpGE
mv
.
visitInsn
(
ICONST_1
);
// true - null is <= or >= null
mv
.
visitInsn
(
ICONST_1
);
// true - null is <= or >= null
break
;
default
:
throw
new
IllegalStateException
(
"Unsupported: "
+
compInstruction1
);
throw
new
IllegalStateException
(
"Unsupported: "
+
compInstruction1
);
}
mv
.
visitJumpInsn
(
GOTO
,
endOfIf
);
mv
.
visitLabel
(
leftNotNullRightIsNull
);
// stack: right
mv
.
visitLabel
(
leftNotNullRightIsNull
);
// stack: right
// RIGHT==null LEFT!=null
mv
.
visitInsn
(
POP
);
// stack: <nothing>
mv
.
visitInsn
(
POP
);
// stack: <nothing>
// load 0 or 1 depending on comparison instruction
switch
(
compInstruction1
)
{
case
IFGE:
// OpLT
case
IFGT:
// OpLE
mv
.
visitInsn
(
ICONST_0
);
// false - something is not < or <= null
mv
.
visitInsn
(
ICONST_0
);
// false - something is not < or <= null
break
;
case
IFLE:
// OpGT
case
IFLT:
// OpGE
mv
.
visitInsn
(
ICONST_1
);
// true - something is > or >= null
mv
.
visitInsn
(
ICONST_1
);
// true - something is > or >= null
break
;
default
:
throw
new
IllegalStateException
(
"Unsupported: "
+
compInstruction1
);
throw
new
IllegalStateException
(
"Unsupported: "
+
compInstruction1
);
}
mv
.
visitJumpInsn
(
GOTO
,
endOfIf
);
mv
.
visitLabel
(
rightIsNonNull
);
// stack: left/right
mv
.
visitLabel
(
rightIsNonNull
);
// stack: left/right
// here: RIGHT!=null LEFT==unknown
mv
.
visitInsn
(
SWAP
);
// stack: right/left
mv
.
visitInsn
(
DUP
);
// stack: right/left/left
mv
.
visitInsn
(
SWAP
);
// stack: right/left
mv
.
visitInsn
(
DUP
);
// stack: right/left/left
Label
neitherRightNorLeftAreNull
=
new
Label
();
mv
.
visitJumpInsn
(
IFNONNULL
,
neitherRightNorLeftAreNull
);
// stack: right/left
mv
.
visitJumpInsn
(
IFNONNULL
,
neitherRightNorLeftAreNull
);
// stack: right/left
// here: RIGHT!=null LEFT==null
mv
.
visitInsn
(
POP2
);
// stack: <nothing>
mv
.
visitInsn
(
POP2
);
// stack: <nothing>
switch
(
compInstruction1
)
{
case
IFGE:
// OpLT
case
IFGT:
// OpLE
mv
.
visitInsn
(
ICONST_1
);
// true - null is < or <= something
mv
.
visitInsn
(
ICONST_1
);
// true - null is < or <= something
break
;
case
IFLE:
// OpGT
case
IFLT:
// OpGE
mv
.
visitInsn
(
ICONST_0
);
// false - null is not > or >= something
mv
.
visitInsn
(
ICONST_0
);
// false - null is not > or >= something
break
;
default
:
throw
new
IllegalStateException
(
"Unsupported: "
+
compInstruction1
);
throw
new
IllegalStateException
(
"Unsupported: "
+
compInstruction1
);
}
mv
.
visitJumpInsn
(
GOTO
,
endOfIf
);
mv
.
visitLabel
(
neitherRightNorLeftAreNull
);
// stack: right/left
mv
.
visitLabel
(
neitherRightNorLeftAreNull
);
// stack: right/left
// neither were null so unbox and proceed with numeric comparison
if
(
unboxLeft
)
{
CodeFlow
.
insertUnboxInsns
(
mv
,
targetType
,
leftDesc
);
...
...
spring-expression/src/test/java/org/springframework/expression/spel/SpelCompilationCoverageTests.java
浏览文件 @
ce916206
...
...
@@ -4994,7 +4994,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
private
void
verifyCompilationAndBehaviourWithNull
(
String
expressionText
,
SpelExpressionParser
parser
,
StandardEvaluationContext
ctx
)
{
Reg
r
=
(
Reg
)
ctx
.
getRootObject
().
getValue
();
r
.
setValue2
(
1
);
// having a value in value2 fields will enable compilation to succeed, then can switch it to null
r
.
setValue2
(
1
);
// having a value in value2 fields will enable compilation to succeed, then can switch it to null
SpelExpression
fast
=
(
SpelExpression
)
parser
.
parseExpression
(
expressionText
);
SpelExpression
slow
=
(
SpelExpression
)
parser
.
parseExpression
(
expressionText
);
fast
.
getValue
(
ctx
);
...
...
@@ -5124,7 +5124,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
}
//
h
elper methods
//
H
elper methods
private
SpelNodeImpl
getAst
()
{
SpelExpression
spelExpression
=
(
SpelExpression
)
expression
;
...
...
@@ -5196,69 +5196,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
}
// nested types
public
class
Reg
{
private
Integer
_value
,
_value2
;
private
Long
_valueL
,
_valueL2
;
private
Double
_valueD
,
_valueD2
;
private
Float
_valueF
,
_valueF2
;
public
Reg
(
int
v
)
{
this
.
_value
=
v
;
this
.
_valueL
=
new
Long
(
v
);
this
.
_valueD
=
new
Double
(
v
);
this
.
_valueF
=
new
Float
(
v
);
}
public
Integer
getValue
()
{
return
_value
;
}
public
Long
getValueL
()
{
return
_valueL
;
}
public
Double
getValueD
()
{
return
_valueD
;
}
public
Float
getValueF
()
{
return
_valueF
;
}
public
Integer
getValue2
()
{
return
_value2
;
}
public
Long
getValueL2
()
{
return
_valueL2
;
}
public
Double
getValueD2
()
{
return
_valueD2
;
}
public
Float
getValueF2
()
{
return
_valueF2
;
}
public
void
setValue
(
Integer
value
)
{
_value
=
value
;
_valueL
=
value
==
null
?
null
:
new
Long
(
value
);
_valueD
=
value
==
null
?
null
:
new
Double
(
value
);
_valueF
=
value
==
null
?
null
:
new
Float
(
value
);
}
public
void
setValue2
(
Integer
value
)
{
_value2
=
value
;
_valueL2
=
value
==
null
?
null
:
new
Long
(
value
);
_valueD2
=
value
==
null
?
null
:
new
Double
(
value
);
_valueF2
=
value
==
null
?
null
:
new
Float
(
value
);
}
}
// Nested types
public
interface
Message
<
T
>
{
...
...
@@ -6276,4 +6214,66 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
public
Long
someLong
=
3L
;
}
public
class
Reg
{
private
Integer
_value
,
_value2
;
private
Long
_valueL
,
_valueL2
;
private
Double
_valueD
,
_valueD2
;
private
Float
_valueF
,
_valueF2
;
public
Reg
(
int
v
)
{
this
.
_value
=
v
;
this
.
_valueL
=
new
Long
(
v
);
this
.
_valueD
=
new
Double
(
v
);
this
.
_valueF
=
new
Float
(
v
);
}
public
Integer
getValue
()
{
return
_value
;
}
public
Long
getValueL
()
{
return
_valueL
;
}
public
Double
getValueD
()
{
return
_valueD
;
}
public
Float
getValueF
()
{
return
_valueF
;
}
public
Integer
getValue2
()
{
return
_value2
;
}
public
Long
getValueL2
()
{
return
_valueL2
;
}
public
Double
getValueD2
()
{
return
_valueD2
;
}
public
Float
getValueF2
()
{
return
_valueF2
;
}
public
void
setValue
(
Integer
value
)
{
_value
=
value
;
_valueL
=
value
==
null
?
null
:
new
Long
(
value
);
_valueD
=
value
==
null
?
null
:
new
Double
(
value
);
_valueF
=
value
==
null
?
null
:
new
Float
(
value
);
}
public
void
setValue2
(
Integer
value
)
{
_value2
=
value
;
_valueL2
=
value
==
null
?
null
:
new
Long
(
value
);
_valueD2
=
value
==
null
?
null
:
new
Double
(
value
);
_valueF2
=
value
==
null
?
null
:
new
Float
(
value
);
}
}
}
spring-tx/src/main/java/org/springframework/transaction/annotation/Propagation.java
浏览文件 @
ce916206
...
...
@@ -87,11 +87,11 @@ public enum Propagation {
/**
* Execute within a nested transaction if a current transaction exists,
* behave like {@code REQUIRED}
el
se. There is no analogous feature in EJB.
* behave like {@code REQUIRED}
otherwi
se. There is no analogous feature in EJB.
* <p>Note: Actual creation of a nested transaction will only work on specific
* transaction managers. Out of the box, this only applies to the JDBC
* DataSourceTransactionManager
when working on a JDBC 3.0 driver.
*
Some JTA providers might support nested
transactions as well.
* DataSourceTransactionManager
. Some JTA providers might support nested
* transactions as well.
* @see org.springframework.jdbc.datasource.DataSourceTransactionManager
*/
NESTED
(
TransactionDefinition
.
PROPAGATION_NESTED
);
...
...
spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java
浏览文件 @
ce916206
/*
* 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.
...
...
@@ -553,7 +553,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
if
(
definition
.
getTimeout
()
!=
TransactionDefinition
.
TIMEOUT_DEFAULT
)
{
return
definition
.
getTimeout
();
}
return
this
.
defaultTimeout
;
return
getDefaultTimeout
()
;
}
...
...
@@ -1099,6 +1099,8 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* @param definition a TransactionDefinition instance, describing propagation
* behavior, isolation level, read-only flag, timeout, and transaction name
* @throws TransactionException in case of creation or system errors
* @throws org.springframework.transaction.NestedTransactionNotSupportedException
* if the underlying transaction does not support nesting
*/
protected
abstract
void
doBegin
(
Object
transaction
,
TransactionDefinition
definition
)
throws
TransactionException
;
...
...
spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java
浏览文件 @
ce916206
/*
* 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.
...
...
@@ -292,10 +292,11 @@ public abstract class TransactionSynchronizationManager {
throws
IllegalStateException
{
Assert
.
notNull
(
synchronization
,
"TransactionSynchronization must not be null"
);
if
(!
isSynchronizationActive
())
{
Set
<
TransactionSynchronization
>
synchs
=
synchronizations
.
get
();
if
(
synchs
==
null
)
{
throw
new
IllegalStateException
(
"Transaction synchronization is not active"
);
}
synch
ronizations
.
get
()
.
add
(
synchronization
);
synch
s
.
add
(
synchronization
);
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录