Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
e4c57a9b
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 搜索 >>
提交
e4c57a9b
编写于
11月 13, 2019
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor internal refinements (backported from master)
上级
b0d8a667
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
46 addition
and
39 deletion
+46
-39
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
...s/factory/support/AbstractAutowireCapableBeanFactory.java
+6
-13
spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java
...ontext/support/ReloadableResourceBundleMessageSource.java
+19
-7
spring-context/src/test/java/org/springframework/context/event/AnnotationDrivenEventListenerTests.java
...ork/context/event/AnnotationDrivenEventListenerTests.java
+6
-3
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/EventSourceTransportHandler.java
...sockjs/transport/handler/EventSourceTransportHandler.java
+5
-5
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/HtmlFileTransportHandler.java
...et/sockjs/transport/handler/HtmlFileTransportHandler.java
+2
-2
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/WebSocketTransportHandler.java
...t/sockjs/transport/handler/WebSocketTransportHandler.java
+2
-2
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/XhrPollingTransportHandler.java
.../sockjs/transport/handler/XhrPollingTransportHandler.java
+2
-2
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/XhrStreamingTransportHandler.java
...ockjs/transport/handler/XhrStreamingTransportHandler.java
+4
-5
未找到文件。
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
浏览文件 @
e4c57a9b
...
...
@@ -645,7 +645,6 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
@Nullable
protected
Class
<?>
predictBeanType
(
String
beanName
,
RootBeanDefinition
mbd
,
Class
<?>...
typesToMatch
)
{
Class
<?>
targetType
=
determineTargetType
(
beanName
,
mbd
,
typesToMatch
);
// Apply SmartInstantiationAwareBeanPostProcessors to predict the
// eventual type after a before-instantiation shortcut.
if
(
targetType
!=
null
&&
!
mbd
.
isSynthetic
()
&&
hasInstantiationAwareBeanPostProcessors
())
{
...
...
@@ -1364,34 +1363,28 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
// Give any InstantiationAwareBeanPostProcessors the opportunity to modify the
// state of the bean before properties are set. This can be used, for example,
// to support styles of field injection.
boolean
continueWithPropertyPopulation
=
true
;
if
(!
mbd
.
isSynthetic
()
&&
hasInstantiationAwareBeanPostProcessors
())
{
for
(
BeanPostProcessor
bp
:
getBeanPostProcessors
())
{
if
(
bp
instanceof
InstantiationAwareBeanPostProcessor
)
{
InstantiationAwareBeanPostProcessor
ibp
=
(
InstantiationAwareBeanPostProcessor
)
bp
;
if
(!
ibp
.
postProcessAfterInstantiation
(
bw
.
getWrappedInstance
(),
beanName
))
{
continueWithPropertyPopulation
=
false
;
break
;
return
;
}
}
}
}
if
(!
continueWithPropertyPopulation
)
{
return
;
}
PropertyValues
pvs
=
(
mbd
.
hasPropertyValues
()
?
mbd
.
getPropertyValues
()
:
null
);
if
(
mbd
.
getResolvedAutowireMode
()
==
AUTOWIRE_BY_NAME
||
mbd
.
getResolvedAutowireMode
()
==
AUTOWIRE_BY_TYPE
)
{
int
resolvedAutowireMode
=
mbd
.
getResolvedAutowireMode
();
if
(
resolvedAutowireMode
==
AUTOWIRE_BY_NAME
||
resolvedAutowireMode
==
AUTOWIRE_BY_TYPE
)
{
MutablePropertyValues
newPvs
=
new
MutablePropertyValues
(
pvs
);
// Add property values based on autowire by name if applicable.
if
(
mbd
.
getResolvedAutowireMode
()
==
AUTOWIRE_BY_NAME
)
{
if
(
resolvedAutowireMode
==
AUTOWIRE_BY_NAME
)
{
autowireByName
(
beanName
,
mbd
,
bw
,
newPvs
);
}
// Add property values based on autowire by type if applicable.
if
(
mbd
.
getResolvedAutowireMode
()
==
AUTOWIRE_BY_TYPE
)
{
if
(
resolvedAutowireMode
==
AUTOWIRE_BY_TYPE
)
{
autowireByType
(
beanName
,
mbd
,
bw
,
newPvs
);
}
pvs
=
newPvs
;
...
...
@@ -1495,7 +1488,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
if
(
Object
.
class
!=
pd
.
getPropertyType
())
{
MethodParameter
methodParam
=
BeanUtils
.
getWriteMethodParameter
(
pd
);
// Do not allow eager init for type matching in case of a prioritized post-processor.
boolean
eager
=
!
PriorityOrdered
.
class
.
isInstance
(
bw
.
getWrappedInstance
()
);
boolean
eager
=
!
(
bw
.
getWrappedInstance
()
instanceof
PriorityOrdered
);
DependencyDescriptor
desc
=
new
AutowireByTypeDependencyDescriptor
(
methodParam
,
eager
);
Object
autowiredArgument
=
resolveDependency
(
desc
,
beanName
,
autowiredBeanNames
,
converter
);
if
(
autowiredArgument
!=
null
)
{
...
...
spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java
浏览文件 @
e4c57a9b
/*
* 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.
...
...
@@ -237,6 +237,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
if
(
mergedHolder
!=
null
)
{
return
mergedHolder
;
}
Properties
mergedProps
=
newProperties
();
long
latestTimestamp
=
-
1
;
String
[]
basenames
=
StringUtils
.
toStringArray
(
getBasenameSet
());
...
...
@@ -253,6 +254,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
}
}
}
mergedHolder
=
new
PropertiesHolder
(
mergedProps
,
latestTimestamp
);
PropertiesHolder
existing
=
this
.
cachedMergedProperties
.
putIfAbsent
(
locale
,
mergedHolder
);
if
(
existing
!=
null
)
{
...
...
@@ -279,18 +281,28 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
return
filenames
;
}
}
// Filenames for given Locale
List
<
String
>
filenames
=
new
ArrayList
<>(
7
);
filenames
.
addAll
(
calculateFilenamesForLocale
(
basename
,
locale
));
if
(
isFallbackToSystemLocale
()
&&
!
locale
.
equals
(
Locale
.
getDefault
()))
{
List
<
String
>
fallbackFilenames
=
calculateFilenamesForLocale
(
basename
,
Locale
.
getDefault
());
for
(
String
fallbackFilename
:
fallbackFilenames
)
{
if
(!
filenames
.
contains
(
fallbackFilename
))
{
// Entry for fallback locale that isn't already in filenames list.
filenames
.
add
(
fallbackFilename
);
// Filenames for default Locale, if any
if
(
isFallbackToSystemLocale
())
{
Locale
defaultLocale
=
Locale
.
getDefault
();
if
(!
locale
.
equals
(
defaultLocale
))
{
List
<
String
>
fallbackFilenames
=
calculateFilenamesForLocale
(
basename
,
defaultLocale
);
for
(
String
fallbackFilename
:
fallbackFilenames
)
{
if
(!
filenames
.
contains
(
fallbackFilename
))
{
// Entry for fallback locale that isn't already in filenames list.
filenames
.
add
(
fallbackFilename
);
}
}
}
}
// Filename for default bundle file
filenames
.
add
(
basename
);
if
(
localeMap
==
null
)
{
localeMap
=
new
ConcurrentHashMap
<>();
Map
<
Locale
,
List
<
String
>>
existing
=
this
.
cachedFilenames
.
putIfAbsent
(
basename
,
localeMap
);
...
...
spring-context/src/test/java/org/springframework/context/event/AnnotationDrivenEventListenerTests.java
浏览文件 @
e4c57a9b
/*
* 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.
...
...
@@ -794,6 +794,7 @@ public class AnnotationDrivenEventListenerTests {
@EventListener
@Async
@Override
public
void
handleAsync
(
AnotherTestEvent
event
)
{
assertTrue
(!
Thread
.
currentThread
().
getName
().
equals
(
event
.
content
));
this
.
eventCollector
.
addEvent
(
this
,
event
);
...
...
@@ -820,6 +821,7 @@ public class AnnotationDrivenEventListenerTests {
@EventListener
@Async
@Override
public
void
handleAsync
(
AnotherTestEvent
event
)
{
assertTrue
(!
Thread
.
currentThread
().
getName
().
equals
(
event
.
content
));
this
.
eventCollector
.
addEvent
(
this
,
event
);
...
...
@@ -902,7 +904,6 @@ public class AnnotationDrivenEventListenerTests {
}
@EventListener
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
ConditionalEvent
{
...
...
@@ -934,18 +935,20 @@ public class AnnotationDrivenEventListenerTests {
super
.
handle
(
event
);
}
@Override
@EventListener
(
condition
=
"#payload.startsWith('OK')"
)
@Override
public
void
handleString
(
String
payload
)
{
super
.
handleString
(
payload
);
}
@ConditionalEvent
(
"#root.event.timestamp > #p0"
)
@Override
public
void
handleTimestamp
(
Long
timestamp
)
{
collectEvent
(
timestamp
);
}
@ConditionalEvent
(
"@conditionEvaluator.valid(#p0)"
)
@Override
public
void
handleRatio
(
Double
ratio
)
{
collectEvent
(
ratio
);
}
...
...
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/EventSourceTransportHandler.java
浏览文件 @
e4c57a9b
/*
* 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.
...
...
@@ -30,7 +30,7 @@ import org.springframework.web.socket.sockjs.transport.TransportType;
import
org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession
;
/**
* A TransportHandler for sending messages via Server-Sent
e
vents:
* A TransportHandler for sending messages via Server-Sent
E
vents:
* <a href="https://dev.w3.org/html5/eventsource/">https://dev.w3.org/html5/eventsource/</a>.
*
* @author Rossen Stoyanchev
...
...
@@ -50,7 +50,7 @@ public class EventSourceTransportHandler extends AbstractHttpSendingTransportHan
@Override
public
boolean
checkSessionType
(
SockJsSession
session
)
{
return
session
instanceof
EventSourceStreamingSockJsSession
;
return
(
session
instanceof
EventSourceStreamingSockJsSession
)
;
}
@Override
...
...
@@ -66,7 +66,7 @@ public class EventSourceTransportHandler extends AbstractHttpSendingTransportHan
}
private
class
EventSourceStreamingSockJsSession
extends
StreamingSockJsSession
{
private
static
class
EventSourceStreamingSockJsSession
extends
StreamingSockJsSession
{
public
EventSourceStreamingSockJsSession
(
String
sessionId
,
SockJsServiceConfig
config
,
WebSocketHandler
wsHandler
,
Map
<
String
,
Object
>
attributes
)
{
...
...
@@ -76,7 +76,7 @@ public class EventSourceTransportHandler extends AbstractHttpSendingTransportHan
@Override
protected
byte
[]
getPrelude
(
ServerHttpRequest
request
)
{
return
new
byte
[]
{
'\r'
,
'\n'
};
return
new
byte
[]
{
'\r'
,
'\n'
};
}
}
...
...
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/HtmlFileTransportHandler.java
浏览文件 @
e4c57a9b
/*
* 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.
...
...
@@ -93,7 +93,7 @@ public class HtmlFileTransportHandler extends AbstractHttpSendingTransportHandle
@Override
public
boolean
checkSessionType
(
SockJsSession
session
)
{
return
session
instanceof
HtmlFileStreamingSockJsSession
;
return
(
session
instanceof
HtmlFileStreamingSockJsSession
)
;
}
@Override
...
...
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/WebSocketTransportHandler.java
浏览文件 @
e4c57a9b
/*
* 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.
...
...
@@ -107,7 +107,7 @@ public class WebSocketTransportHandler extends AbstractTransportHandler
@Override
public
boolean
checkSessionType
(
SockJsSession
session
)
{
return
session
instanceof
WebSocketServerSockJsSession
;
return
(
session
instanceof
WebSocketServerSockJsSession
)
;
}
@Override
...
...
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/XhrPollingTransportHandler.java
浏览文件 @
e4c57a9b
/*
* 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.
...
...
@@ -54,7 +54,7 @@ public class XhrPollingTransportHandler extends AbstractHttpSendingTransportHand
@Override
public
boolean
checkSessionType
(
SockJsSession
session
)
{
return
session
instanceof
PollingSockJsSession
;
return
(
session
instanceof
PollingSockJsSession
)
;
}
@Override
...
...
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/XhrStreamingTransportHandler.java
浏览文件 @
e4c57a9b
/*
* 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.
...
...
@@ -17,6 +17,7 @@
package
org.springframework.web.socket.sockjs.transport.handler
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Arrays
;
import
java.util.Map
;
import
org.springframework.http.MediaType
;
...
...
@@ -41,9 +42,7 @@ public class XhrStreamingTransportHandler extends AbstractHttpSendingTransportHa
private
static
final
byte
[]
PRELUDE
=
new
byte
[
2049
];
static
{
for
(
int
i
=
0
;
i
<
2048
;
i
++)
{
PRELUDE
[
i
]
=
'h'
;
}
Arrays
.
fill
(
PRELUDE
,
(
byte
)
'h'
);
PRELUDE
[
2048
]
=
'\n'
;
}
...
...
@@ -60,7 +59,7 @@ public class XhrStreamingTransportHandler extends AbstractHttpSendingTransportHa
@Override
public
boolean
checkSessionType
(
SockJsSession
session
)
{
return
session
instanceof
XhrStreamingSockJsSession
;
return
(
session
instanceof
XhrStreamingSockJsSession
)
;
}
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录