Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
130f4102
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 搜索 >>
提交
130f4102
编写于
2月 27, 2019
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
5c20c976
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
53 addition
and
48 deletion
+53
-48
spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
...tory/annotation/AutowiredAnnotationBeanPostProcessor.java
+1
-1
spring-beans/src/main/java/org/springframework/beans/factory/config/BeanExpressionContext.java
...framework/beans/factory/config/BeanExpressionContext.java
+2
-2
spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java
...eans/factory/config/PreferencesPlaceholderConfigurer.java
+2
-2
spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java
...work/beans/factory/config/PropertyOverrideConfigurer.java
+11
-7
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
...s/factory/support/AbstractAutowireCapableBeanFactory.java
+6
-7
spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
...ork/beans/factory/support/DefaultListableBeanFactory.java
+1
-1
spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java
...beans/factory/support/PropertiesBeanDefinitionReader.java
+14
-14
spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java
...work/beans/factory/support/StaticListableBeanFactory.java
+1
-1
spring-beans/src/main/java/org/springframework/beans/factory/xml/PluggableSchemaResolver.java
...gframework/beans/factory/xml/PluggableSchemaResolver.java
+4
-4
spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java
.../beans/factory/xml/SimpleConstructorNamespaceHandler.java
+3
-3
spring-core/src/main/java/org/springframework/core/AttributeAccessor.java
...main/java/org/springframework/core/AttributeAccessor.java
+2
-2
spring-core/src/main/java/org/springframework/util/ClassUtils.java
...re/src/main/java/org/springframework/util/ClassUtils.java
+3
-1
spring-core/src/main/java/org/springframework/util/UpdateMessageDigestInputStream.java
.../springframework/util/UpdateMessageDigestInputStream.java
+3
-3
未找到文件。
spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
浏览文件 @
130f4102
...
...
@@ -697,7 +697,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
ReflectionUtils
.
makeAccessible
(
method
);
method
.
invoke
(
bean
,
arguments
);
}
catch
(
InvocationTargetException
ex
){
catch
(
InvocationTargetException
ex
)
{
throw
ex
.
getTargetException
();
}
}
...
...
spring-beans/src/main/java/org/springframework/beans/factory/config/BeanExpressionContext.java
浏览文件 @
130f4102
/*
* Copyright 2002-20
09
the original author or authors.
* Copyright 2002-20
18
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.
...
...
@@ -55,7 +55,7 @@ public class BeanExpressionContext {
if
(
this
.
beanFactory
.
containsBean
(
key
))
{
return
this
.
beanFactory
.
getBean
(
key
);
}
else
if
(
this
.
scope
!=
null
){
else
if
(
this
.
scope
!=
null
)
{
return
this
.
scope
.
resolveContextualObject
(
key
);
}
else
{
...
...
spring-beans/src/main/java/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java
浏览文件 @
130f4102
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -115,7 +115,7 @@ public class PreferencesPlaceholderConfigurer extends PropertyPlaceholderConfigu
*/
protected
String
resolvePlaceholder
(
String
path
,
String
key
,
Preferences
preferences
)
{
if
(
path
!=
null
)
{
// Do not create the node if it does not exist...
// Do not create the node if it does not exist...
try
{
if
(
preferences
.
nodeExists
(
path
))
{
return
preferences
.
node
(
path
).
get
(
key
,
null
);
...
...
spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyOverrideConfigurer.java
浏览文件 @
130f4102
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -64,6 +64,9 @@ import org.springframework.beans.factory.BeanInitializationException;
*/
public
class
PropertyOverrideConfigurer
extends
PropertyResourceConfigurer
{
/**
* The default bean name separator.
*/
public
static
final
String
DEFAULT_BEAN_NAME_SEPARATOR
=
"."
;
...
...
@@ -72,7 +75,7 @@ public class PropertyOverrideConfigurer extends PropertyResourceConfigurer {
private
boolean
ignoreInvalidKeys
=
false
;
/**
* Contains names of beans that have overrides
* Contains names of beans that have overrides
.
*/
private
final
Set
<
String
>
beanNames
=
Collections
.
newSetFromMap
(
new
ConcurrentHashMap
<
String
,
Boolean
>(
16
));
...
...
@@ -129,7 +132,7 @@ public class PropertyOverrideConfigurer extends PropertyResourceConfigurer {
"': expected 'beanName"
+
this
.
beanNameSeparator
+
"property'"
);
}
String
beanName
=
key
.
substring
(
0
,
separatorIndex
);
String
beanProperty
=
key
.
substring
(
separatorIndex
+
1
);
String
beanProperty
=
key
.
substring
(
separatorIndex
+
1
);
this
.
beanNames
.
add
(
beanName
);
applyPropertyValue
(
factory
,
beanName
,
beanProperty
,
value
);
if
(
logger
.
isDebugEnabled
())
{
...
...
@@ -144,12 +147,14 @@ public class PropertyOverrideConfigurer extends PropertyResourceConfigurer {
ConfigurableListableBeanFactory
factory
,
String
beanName
,
String
property
,
String
value
)
{
BeanDefinition
bd
=
factory
.
getBeanDefinition
(
beanName
);
while
(
bd
.
getOriginatingBeanDefinition
()
!=
null
)
{
BeanDefinition
bdToUse
=
bd
;
while
(
bd
!=
null
)
{
bdToUse
=
bd
;
bd
=
bd
.
getOriginatingBeanDefinition
();
}
PropertyValue
pv
=
new
PropertyValue
(
property
,
value
);
pv
.
setOptional
(
this
.
ignoreInvalidKeys
);
bd
.
getPropertyValues
().
addPropertyValue
(
pv
);
bd
ToUse
.
getPropertyValues
().
addPropertyValue
(
pv
);
}
...
...
@@ -157,8 +162,7 @@ public class PropertyOverrideConfigurer extends PropertyResourceConfigurer {
* Were there overrides for this bean?
* Only valid after processing has occurred at least once.
* @param beanName name of the bean to query status for
* @return whether there were property overrides for
* the named bean
* @return whether there were property overrides for the named bean
*/
public
boolean
hasPropertyOverridesFor
(
String
beanName
)
{
return
this
.
beanNames
.
contains
(
beanName
);
...
...
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
浏览文件 @
130f4102
/*
* 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.
...
...
@@ -955,7 +955,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
return
null
;
}
Object
instance
=
null
;
Object
instance
;
try
{
// Mark this bean as currently in creation, even if just partially.
beforePrototypeCreation
(
beanName
);
...
...
@@ -1068,7 +1068,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
"Bean class isn't public, and non-public access not allowed: "
+
beanClass
.
getName
());
}
if
(
mbd
.
getFactoryMethodName
()
!=
null
)
{
if
(
mbd
.
getFactoryMethodName
()
!=
null
)
{
return
instantiateUsingFactoryMethod
(
beanName
,
mbd
,
args
);
}
...
...
@@ -1092,11 +1092,10 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
}
}
//
Need to determine the constructor...
//
Candidate constructors for autowiring?
Constructor
<?>[]
ctors
=
determineConstructorsFromBeanPostProcessors
(
beanClass
,
beanName
);
if
(
ctors
!=
null
||
mbd
.
getResolvedAutowireMode
()
==
RootBeanDefinition
.
AUTOWIRE_CONSTRUCTOR
||
mbd
.
hasConstructorArgumentValues
()
||
!
ObjectUtils
.
isEmpty
(
args
))
{
if
(
ctors
!=
null
||
mbd
.
getResolvedAutowireMode
()
==
AUTOWIRE_CONSTRUCTOR
||
mbd
.
hasConstructorArgumentValues
()
||
!
ObjectUtils
.
isEmpty
(
args
))
{
return
autowireConstructor
(
beanName
,
mbd
,
ctors
,
args
);
}
...
...
spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
浏览文件 @
130f4102
...
...
@@ -574,7 +574,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
*/
@Override
public
<
A
extends
Annotation
>
A
findAnnotationOnBean
(
String
beanName
,
Class
<
A
>
annotationType
)
throws
NoSuchBeanDefinitionException
{
throws
NoSuchBeanDefinitionException
{
A
ann
=
null
;
Class
<?>
beanType
=
getType
(
beanName
);
...
...
spring-beans/src/main/java/org/springframework/beans/factory/support/PropertiesBeanDefinitionReader.java
浏览文件 @
130f4102
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -88,7 +88,7 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
public
static
final
String
SEPARATOR
=
"."
;
/**
* Special key to distinguish {@code owner.(class)=com.myapp.MyClass}
-
* Special key to distinguish {@code owner.(class)=com.myapp.MyClass}
.
*/
public
static
final
String
CLASS_KEY
=
"(class)"
;
...
...
@@ -300,10 +300,10 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
/**
* Register bean definitions contained in a Map,
*
using all property keys (i.e. not
filtering by prefix).
* @param map
Map: name -> property (String or Object). Property values
* will be strings if coming from a Properties file etc. Property names
* Register bean definitions contained in a Map,
using all property keys (i.e. not
* filtering by prefix).
* @param map
a map of {@code name} to {@code property} (String or Object). Property
*
values
will be strings if coming from a Properties file etc. Property names
* (keys) <b>must</b> be Strings. Class keys must be Strings.
* @return the number of bean definitions found
* @throws BeansException in case of loading or parsing errors
...
...
@@ -316,8 +316,8 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
/**
* Register bean definitions contained in a Map.
* Ignore ineligible properties.
* @param map
Map name -> property (String or Object). Property values
* will be strings if coming from a Properties file etc. Property names
* @param map
a map of {@code name} to {@code property} (String or Object). Property
*
values
will be strings if coming from a Properties file etc. Property names
* (keys) <b>must</b> be Strings. Class keys must be Strings.
* @param prefix a filter within the keys in the map: e.g. 'beans.'
* (can be empty or {@code null})
...
...
@@ -331,9 +331,9 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
/**
* Register bean definitions contained in a Map.
* Ignore ineligible properties.
* @param map
Map name -> property (String or Object). Property values
* will be strings if coming from a Properties file etc. Property names
* (keys) <b>must</b> be
s
trings. Class keys must be Strings.
* @param map
a map of {@code name} to {@code property} (String or Object). Property
*
values
will be strings if coming from a Properties file etc. Property names
* (keys) <b>must</b> be
S
trings. Class keys must be Strings.
* @param prefix a filter within the keys in the map: e.g. 'beans.'
* (can be empty or {@code null})
* @param resourceDescription description of the resource that the
...
...
@@ -393,9 +393,9 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
/**
* Get all property values, given a prefix (which will be stripped)
* and add the bean they define to the factory with the given name
* and add the bean they define to the factory with the given name
.
* @param beanName name of the bean to define
* @param map Map containing string pairs
* @param map
a
Map containing string pairs
* @param prefix prefix of each entry, which will be stripped
* @param resourceDescription description of the resource that the
* Map came from (for logging purposes)
...
...
@@ -502,7 +502,7 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
* Reads the value of the entry. Correctly interprets bean references for
* values that are prefixed with an asterisk.
*/
private
Object
readValue
(
Map
.
Entry
<?
,
?>
entry
)
{
private
Object
readValue
(
Map
.
Entry
<?
,
?>
entry
)
{
Object
val
=
entry
.
getValue
();
if
(
val
instanceof
String
)
{
String
strVal
=
(
String
)
val
;
...
...
spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java
浏览文件 @
130f4102
...
...
@@ -351,7 +351,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
@Override
public
<
A
extends
Annotation
>
A
findAnnotationOnBean
(
String
beanName
,
Class
<
A
>
annotationType
)
throws
NoSuchBeanDefinitionException
{
throws
NoSuchBeanDefinitionException
{
Class
<?>
beanType
=
getType
(
beanName
);
return
(
beanType
!=
null
?
AnnotationUtils
.
findAnnotation
(
beanType
,
annotationType
)
:
null
);
...
...
spring-beans/src/main/java/org/springframework/beans/factory/xml/PluggableSchemaResolver.java
浏览文件 @
130f4102
...
...
@@ -43,12 +43,12 @@ import org.springframework.util.CollectionUtils;
*
* <p>The format of {@code META-INF/spring.schemas} is a properties file where each line
* should be of the form {@code systemId=schema-location} where {@code schema-location}
* should also be a schema file in the classpath. Since
systemId is commonly a URL,
* one must be careful to escape any ':' characters which are treated as delimiters
* should also be a schema file in the classpath. Since
{@code systemId} is commonly a
*
URL,
one must be careful to escape any ':' characters which are treated as delimiters
* in properties files.
*
* <p>The pattern for the mapping files can be overidden using the
* {@link #PluggableSchemaResolver(ClassLoader, String)} constructor
* <p>The pattern for the mapping files can be over
r
idden using the
* {@link #PluggableSchemaResolver(ClassLoader, String)} constructor
.
*
* @author Rob Harrop
* @author Juergen Hoeller
...
...
spring-beans/src/main/java/org/springframework/beans/factory/xml/SimpleConstructorNamespaceHandler.java
浏览文件 @
130f4102
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -116,7 +116,7 @@ public class SimpleConstructorNamespaceHandler implements NamespaceHandler {
"Constructor argument '"
+
argName
+
"' specifies a negative index"
,
attr
);
}
if
(
cvs
.
hasIndexedArgumentValue
(
index
)){
if
(
cvs
.
hasIndexedArgumentValue
(
index
))
{
parserContext
.
getReaderContext
().
error
(
"Constructor argument '"
+
argName
+
"' with index "
+
index
+
" already defined using <constructor-arg>."
+
" Only one approach may be used per argument."
,
attr
);
...
...
@@ -128,7 +128,7 @@ public class SimpleConstructorNamespaceHandler implements NamespaceHandler {
// no escaping -> ctr name
else
{
String
name
=
Conventions
.
attributeNameToPropertyName
(
argName
);
if
(
containsArgWithName
(
name
,
cvs
)){
if
(
containsArgWithName
(
name
,
cvs
))
{
parserContext
.
getReaderContext
().
error
(
"Constructor argument '"
+
argName
+
"' already defined using <constructor-arg>."
+
" Only one approach may be used per argument."
,
attr
);
...
...
spring-core/src/main/java/org/springframework/core/AttributeAccessor.java
浏览文件 @
130f4102
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -26,7 +26,7 @@ package org.springframework.core;
public
interface
AttributeAccessor
{
/**
* Set the attribute defined by {@code name} to the supplied
{@code value}.
* Set the attribute defined by {@code name} to the supplied
{@code value}.
* If {@code value} is {@code null}, the attribute is {@link #removeAttribute removed}.
* <p>In general, users should take care to prevent overlaps with other
* metadata attributes by using fully-qualified names, perhaps using
...
...
spring-core/src/main/java/org/springframework/util/ClassUtils.java
浏览文件 @
130f4102
...
...
@@ -709,10 +709,12 @@ public abstract class ClassUtils {
* @param interfaces the interfaces to merge
* @param classLoader the ClassLoader to create the composite Class in
* @return the merged interface as Class
* @throws IllegalArgumentException if the specified interfaces expose
* conflicting method signatures (or a similar constraint is violated)
* @see java.lang.reflect.Proxy#getProxyClass
*/
public
static
Class
<?>
createCompositeInterface
(
Class
<?>[]
interfaces
,
ClassLoader
classLoader
)
{
Assert
.
notEmpty
(
interfaces
,
"Interface
s
must not be empty"
);
Assert
.
notEmpty
(
interfaces
,
"Interface
array
must not be empty"
);
return
Proxy
.
getProxyClass
(
classLoader
,
interfaces
);
}
...
...
spring-core/src/main/java/org/springframework/util/UpdateMessageDigestInputStream.java
浏览文件 @
130f4102
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -38,7 +38,7 @@ abstract class UpdateMessageDigestInputStream extends InputStream {
*/
public
void
updateMessageDigest
(
MessageDigest
messageDigest
)
throws
IOException
{
int
data
;
while
((
data
=
read
())
!=
-
1
){
while
((
data
=
read
())
!=
-
1
)
{
messageDigest
.
update
((
byte
)
data
);
}
}
...
...
@@ -54,7 +54,7 @@ abstract class UpdateMessageDigestInputStream extends InputStream {
public
void
updateMessageDigest
(
MessageDigest
messageDigest
,
int
len
)
throws
IOException
{
int
data
;
int
bytesRead
=
0
;
while
(
bytesRead
<
len
&&
(
data
=
read
())
!=
-
1
){
while
(
bytesRead
<
len
&&
(
data
=
read
())
!=
-
1
)
{
messageDigest
.
update
((
byte
)
data
);
bytesRead
++;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录