Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
7b42a121
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,发现更多精彩内容 >>
提交
7b42a121
编写于
9月 18, 2009
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
consistent loading of optional classes
上级
8d66c907
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
21 deletion
+29
-21
org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
...tory/annotation/AutowiredAnnotationBeanPostProcessor.java
+1
-0
org.springframework.beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
...ork/beans/factory/support/DefaultListableBeanFactory.java
+14
-1
org.springframework.context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
...context/annotation/CommonAnnotationBeanPostProcessor.java
+3
-4
org.springframework.context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationAdvisor.java
...amework/scheduling/annotation/AsyncAnnotationAdvisor.java
+2
-3
org.springframework.core/src/main/java/org/springframework/core/CollectionFactory.java
...main/java/org/springframework/core/CollectionFactory.java
+9
-13
未找到文件。
org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
浏览文件 @
7b42a121
...
...
@@ -132,6 +132,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
ClassLoader
cl
=
AutowiredAnnotationBeanPostProcessor
.
class
.
getClassLoader
();
try
{
this
.
autowiredAnnotationTypes
.
add
((
Class
<?
extends
Annotation
>)
cl
.
loadClass
(
"javax.inject.Inject"
));
logger
.
info
(
"JSR-330 'javax.inject.Inject' annotation found and supported for autowiring"
);
}
catch
(
ClassNotFoundException
ex
)
{
// JSR-330 API not available - simply skip.
...
...
org.springframework.beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
浏览文件 @
7b42a121
...
...
@@ -93,6 +93,19 @@ import org.springframework.util.StringUtils;
public
class
DefaultListableBeanFactory
extends
AbstractAutowireCapableBeanFactory
implements
ConfigurableListableBeanFactory
,
BeanDefinitionRegistry
,
Serializable
{
private
static
Class
javaxInjectProviderClass
=
null
;
static
{
ClassLoader
cl
=
DefaultListableBeanFactory
.
class
.
getClassLoader
();
try
{
javaxInjectProviderClass
=
cl
.
loadClass
(
"javax.inject.Provider"
);
}
catch
(
ClassNotFoundException
ex
)
{
// JSR-330 API not available - Provider interface simply not supported then.
}
}
/** Map from serialized id to factory instance */
private
static
final
Map
<
String
,
Reference
<
DefaultListableBeanFactory
>>
serializableFactories
=
new
ConcurrentHashMap
<
String
,
Reference
<
DefaultListableBeanFactory
>>();
...
...
@@ -646,7 +659,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
if
(
descriptor
.
getDependencyType
().
equals
(
ObjectFactory
.
class
))
{
return
new
DependencyObjectFactory
(
descriptor
,
beanName
);
}
else
if
(
descriptor
.
getDependencyType
().
getName
().
equals
(
"javax.inject.Provider"
))
{
else
if
(
descriptor
.
getDependencyType
().
equals
(
javaxInjectProviderClass
))
{
return
new
DependencyProviderFactory
().
createDependencyProvider
(
descriptor
,
beanName
);
}
else
{
...
...
org.springframework.context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
浏览文件 @
7b42a121
...
...
@@ -140,16 +140,15 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
private
static
Class
<?
extends
Annotation
>
ejbRefClass
=
null
;
static
{
ClassLoader
cl
=
CommonAnnotationBeanPostProcessor
.
class
.
getClassLoader
();
try
{
webServiceRefClass
=
ClassUtils
.
forName
(
"javax.xml.ws.WebServiceRef"
,
CommonAnnotationBeanPostProcessor
.
class
.
getClassLoader
());
webServiceRefClass
=
(
Class
)
cl
.
loadClass
(
"javax.xml.ws.WebServiceRef"
);
}
catch
(
ClassNotFoundException
ex
)
{
webServiceRefClass
=
null
;
}
try
{
ejbRefClass
=
ClassUtils
.
forName
(
"javax.ejb.EJB"
,
CommonAnnotationBeanPostProcessor
.
class
.
getClassLoader
());
ejbRefClass
=
(
Class
)
cl
.
loadClass
(
"javax.ejb.EJB"
);
}
catch
(
ClassNotFoundException
ex
)
{
ejbRefClass
=
null
;
...
...
org.springframework.context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationAdvisor.java
浏览文件 @
7b42a121
...
...
@@ -32,7 +32,6 @@ import org.springframework.aop.support.annotation.AnnotationMatchingPointcut;
import
org.springframework.core.task.AsyncTaskExecutor
;
import
org.springframework.core.task.SimpleAsyncTaskExecutor
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ClassUtils
;
/**
* Advisor that activates asynchronous method execution through the {@link Async}
...
...
@@ -73,9 +72,9 @@ public class AsyncAnnotationAdvisor extends AbstractPointcutAdvisor {
public
AsyncAnnotationAdvisor
(
Executor
executor
)
{
Set
<
Class
<?
extends
Annotation
>>
asyncAnnotationTypes
=
new
LinkedHashSet
<
Class
<?
extends
Annotation
>>(
2
);
asyncAnnotationTypes
.
add
(
Async
.
class
);
ClassLoader
cl
=
AsyncAnnotationAdvisor
.
class
.
getClassLoader
();
try
{
asyncAnnotationTypes
.
add
(
ClassUtils
.
forName
(
"javax.ejb.Asynchronous"
,
AsyncAnnotationAdvisor
.
class
.
getClassLoader
()));
asyncAnnotationTypes
.
add
((
Class
)
cl
.
loadClass
(
"javax.ejb.Asynchronous"
));
}
catch
(
ClassNotFoundException
ex
)
{
// If EJB 3.1 API not present, simply ignore.
...
...
org.springframework.core/src/main/java/org/springframework/core/CollectionFactory.java
浏览文件 @
7b42a121
...
...
@@ -34,7 +34,6 @@ import java.util.TreeSet;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.CopyOnWriteArraySet
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.LinkedCaseInsensitiveMap
;
/**
...
...
@@ -52,13 +51,9 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
*/
public
abstract
class
CollectionFactory
{
private
static
final
String
NAVIGABLE_SET_CLASS_NAME
=
"java.util.NavigableSet"
;
private
static
Class
navigableSetClass
=
null
;
private
static
final
String
NAVIGABLE_MAP_CLASS_NAME
=
"java.util.NavigableMap"
;
private
static
Class
navigableSet
=
null
;
private
static
Class
navigableMap
=
null
;
private
static
Class
navigableMapClass
=
null
;
private
static
final
Set
<
Class
>
approximableCollectionTypes
=
new
HashSet
<
Class
>(
10
);
...
...
@@ -75,11 +70,12 @@ public abstract class CollectionFactory {
approximableMapTypes
.
add
(
SortedMap
.
class
);
// New Java 6 collection interfaces
ClassLoader
cl
=
CollectionFactory
.
class
.
getClassLoader
();
try
{
navigableSet
=
ClassUtils
.
forName
(
NAVIGABLE_SET_CLASS_NAME
,
CollectionFactory
.
class
.
getClassLoader
()
);
navigableMap
=
ClassUtils
.
forName
(
NAVIGABLE_MAP_CLASS_NAME
,
CollectionFactory
.
class
.
getClassLoader
()
);
approximableCollectionTypes
.
add
(
navigableSet
);
approximableMapTypes
.
add
(
navigableMap
);
navigableSet
Class
=
cl
.
loadClass
(
"java.util.NavigableSet"
);
navigableMap
Class
=
cl
.
loadClass
(
"java.util.NavigableMap"
);
approximableCollectionTypes
.
add
(
navigableSet
Class
);
approximableMapTypes
.
add
(
navigableMap
Class
);
}
catch
(
ClassNotFoundException
ex
)
{
// not running on Java 6 or above...
...
...
@@ -240,7 +236,7 @@ public abstract class CollectionFactory {
if
(
List
.
class
.
equals
(
collectionType
))
{
return
new
ArrayList
(
initialCapacity
);
}
else
if
(
SortedSet
.
class
.
equals
(
collectionType
)
||
collectionType
.
equals
(
navigableSet
))
{
else
if
(
SortedSet
.
class
.
equals
(
collectionType
)
||
collectionType
.
equals
(
navigableSet
Class
))
{
return
new
TreeSet
();
}
else
if
(
Set
.
class
.
equals
(
collectionType
)
||
Collection
.
class
.
equals
(
collectionType
))
{
...
...
@@ -307,7 +303,7 @@ public abstract class CollectionFactory {
if
(
Map
.
class
.
equals
(
mapType
))
{
return
new
LinkedHashMap
(
initialCapacity
);
}
else
if
(
SortedMap
.
class
.
equals
(
mapType
)
||
mapType
.
equals
(
navigableMap
))
{
else
if
(
SortedMap
.
class
.
equals
(
mapType
)
||
mapType
.
equals
(
navigableMap
Class
))
{
return
new
TreeMap
();
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录