Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CooperWan
spring-framework
提交
59cef3ce
S
spring-framework
项目概览
CooperWan
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
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,发现更多精彩内容 >>
提交
59cef3ce
编写于
4月 28, 2014
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
General defensiveness about the bootstrap ClassLoader (i.e. null ClassLoader)
Issue: SPR-11721
上级
c8ea80d7
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
139 addition
and
124 deletion
+139
-124
spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java
...java/org/springframework/beans/TypeConverterDelegate.java
+4
-4
spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
...tory/annotation/AutowiredAnnotationBeanPostProcessor.java
+3
-3
spring-beans/src/main/java/org/springframework/beans/factory/annotation/QualifierAnnotationAutowireCandidateResolver.java
...otation/QualifierAnnotationAutowireCandidateResolver.java
+3
-3
spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
...ork/beans/factory/support/DefaultListableBeanFactory.java
+2
-2
spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java
...ramework/beans/factory/support/DisposableBeanAdapter.java
+3
-2
spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java
...ngframework/scheduling/quartz/CronTriggerFactoryBean.java
+3
-2
spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailFactoryBean.java
...ringframework/scheduling/quartz/JobDetailFactoryBean.java
+3
-2
spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java
...scheduling/quartz/MethodInvokingJobDetailFactoryBean.java
+5
-4
spring-context-support/src/main/java/org/springframework/scheduling/quartz/QuartzJobBean.java
.../org/springframework/scheduling/quartz/QuartzJobBean.java
+3
-2
spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java
.../springframework/scheduling/quartz/SchedulerAccessor.java
+3
-2
spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java
...framework/scheduling/quartz/SimpleTriggerFactoryBean.java
+3
-2
spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java
...ngframework/context/annotation/AnnotationConfigUtils.java
+3
-3
spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java
...notation/ClassPathScanningCandidateComponentProvider.java
+3
-3
spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
...context/annotation/CommonAnnotationBeanPostProcessor.java
+5
-4
spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationAdvisor.java
...amework/scheduling/annotation/AsyncAnnotationAdvisor.java
+4
-3
spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java
.../core/io/support/PathMatchingResourcePatternResolver.java
+22
-21
spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java
...pringframework/core/io/support/PropertiesLoaderUtils.java
+1
-1
spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java
...pringframework/core/io/support/SpringFactoriesLoader.java
+2
-2
spring-core/src/main/java/org/springframework/core/type/filter/AnnotationTypeFilter.java
...pringframework/core/type/filter/AnnotationTypeFilter.java
+5
-4
spring-core/src/main/java/org/springframework/core/type/filter/AssignableTypeFilter.java
...pringframework/core/type/filter/AssignableTypeFilter.java
+6
-4
spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeLocator.java
...ramework/expression/spel/support/StandardTypeLocator.java
+3
-3
spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java
...pringframework/jdbc/core/SqlRowSetResultSetExtractor.java
+9
-10
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/OracleTableMetaDataProvider.java
...ework/jdbc/core/metadata/OracleTableMetaDataProvider.java
+9
-7
spring-test/src/main/java/org/springframework/test/context/TestContextManager.java
.../org/springframework/test/context/TestContextManager.java
+26
-25
spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointExporter.java
...rk/web/socket/server/standard/ServerEndpointExporter.java
+6
-6
未找到文件。
spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -289,15 +289,15 @@ class TypeConverterDelegate {
...
@@ -289,15 +289,15 @@ class TypeConverterDelegate {
if
(
index
>
-
1
)
{
if
(
index
>
-
1
)
{
String
enumType
=
trimmedValue
.
substring
(
0
,
index
);
String
enumType
=
trimmedValue
.
substring
(
0
,
index
);
String
fieldName
=
trimmedValue
.
substring
(
index
+
1
);
String
fieldName
=
trimmedValue
.
substring
(
index
+
1
);
ClassLoader
loader
=
this
.
targetObject
.
getClass
().
getClassLoader
();
ClassLoader
cl
=
this
.
targetObject
.
getClass
().
getClassLoader
();
try
{
try
{
Class
<?>
enumValueType
=
loader
.
loadClass
(
enumType
);
Class
<?>
enumValueType
=
ClassUtils
.
forName
(
enumType
,
cl
);
Field
enumField
=
enumValueType
.
getField
(
fieldName
);
Field
enumField
=
enumValueType
.
getField
(
fieldName
);
convertedValue
=
enumField
.
get
(
null
);
convertedValue
=
enumField
.
get
(
null
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
if
(
logger
.
isTraceEnabled
())
{
if
(
logger
.
isTraceEnabled
())
{
logger
.
trace
(
"Enum class ["
+
enumType
+
"] cannot be loaded
from ["
+
loader
+
"]
"
,
ex
);
logger
.
trace
(
"Enum class ["
+
enumType
+
"] cannot be loaded"
,
ex
);
}
}
}
}
catch
(
Throwable
ex
)
{
catch
(
Throwable
ex
)
{
...
...
spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -135,9 +135,9 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
...
@@ -135,9 +135,9 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
public
AutowiredAnnotationBeanPostProcessor
()
{
public
AutowiredAnnotationBeanPostProcessor
()
{
this
.
autowiredAnnotationTypes
.
add
(
Autowired
.
class
);
this
.
autowiredAnnotationTypes
.
add
(
Autowired
.
class
);
this
.
autowiredAnnotationTypes
.
add
(
Value
.
class
);
this
.
autowiredAnnotationTypes
.
add
(
Value
.
class
);
ClassLoader
cl
=
AutowiredAnnotationBeanPostProcessor
.
class
.
getClassLoader
();
try
{
try
{
this
.
autowiredAnnotationTypes
.
add
((
Class
<?
extends
Annotation
>)
cl
.
loadClass
(
"javax.inject.Inject"
));
this
.
autowiredAnnotationTypes
.
add
((
Class
<?
extends
Annotation
>)
ClassUtils
.
forName
(
"javax.inject.Inject"
,
AutowiredAnnotationBeanPostProcessor
.
class
.
getClassLoader
()));
logger
.
info
(
"JSR-330 'javax.inject.Inject' annotation found and supported for autowiring"
);
logger
.
info
(
"JSR-330 'javax.inject.Inject' annotation found and supported for autowiring"
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
...
...
spring-beans/src/main/java/org/springframework/beans/factory/annotation/QualifierAnnotationAutowireCandidateResolver.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -66,9 +66,9 @@ public class QualifierAnnotationAutowireCandidateResolver extends GenericTypeAwa
...
@@ -66,9 +66,9 @@ public class QualifierAnnotationAutowireCandidateResolver extends GenericTypeAwa
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
QualifierAnnotationAutowireCandidateResolver
()
{
public
QualifierAnnotationAutowireCandidateResolver
()
{
this
.
qualifierTypes
.
add
(
Qualifier
.
class
);
this
.
qualifierTypes
.
add
(
Qualifier
.
class
);
ClassLoader
cl
=
QualifierAnnotationAutowireCandidateResolver
.
class
.
getClassLoader
();
try
{
try
{
this
.
qualifierTypes
.
add
((
Class
<?
extends
Annotation
>)
cl
.
loadClass
(
"javax.inject.Qualifier"
));
this
.
qualifierTypes
.
add
((
Class
<?
extends
Annotation
>)
ClassUtils
.
forName
(
"javax.inject.Qualifier"
,
QualifierAnnotationAutowireCandidateResolver
.
class
.
getClassLoader
()));
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
// JSR-330 API not available - simply skip.
// JSR-330 API not available - simply skip.
...
...
spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
浏览文件 @
59cef3ce
...
@@ -105,9 +105,9 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
...
@@ -105,9 +105,9 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
private
static
Class
<?>
javaxInjectProviderClass
=
null
;
private
static
Class
<?>
javaxInjectProviderClass
=
null
;
static
{
static
{
ClassLoader
cl
=
DefaultListableBeanFactory
.
class
.
getClassLoader
();
try
{
try
{
javaxInjectProviderClass
=
cl
.
loadClass
(
"javax.inject.Provider"
);
javaxInjectProviderClass
=
ClassUtils
.
forName
(
"javax.inject.Provider"
,
DefaultListableBeanFactory
.
class
.
getClassLoader
());
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
// JSR-330 API not available - Provider interface simply not supported then.
// JSR-330 API not available - Provider interface simply not supported then.
...
...
spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -69,7 +69,8 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
...
@@ -69,7 +69,8 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
static
{
static
{
try
{
try
{
closeableInterface
=
DisposableBeanAdapter
.
class
.
getClassLoader
().
loadClass
(
"java.lang.AutoCloseable"
);
closeableInterface
=
ClassUtils
.
forName
(
"java.lang.AutoCloseable"
,
DisposableBeanAdapter
.
class
.
getClassLoader
());
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
closeableInterface
=
Closeable
.
class
;
closeableInterface
=
Closeable
.
class
;
...
...
spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -34,6 +34,7 @@ import org.springframework.beans.factory.FactoryBean;
...
@@ -34,6 +34,7 @@ import org.springframework.beans.factory.FactoryBean;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.core.Constants
;
import
org.springframework.core.Constants
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.ReflectionUtils
;
/**
/**
...
@@ -261,7 +262,7 @@ public class CronTriggerFactoryBean implements FactoryBean<CronTrigger>, BeanNam
...
@@ -261,7 +262,7 @@ public class CronTriggerFactoryBean implements FactoryBean<CronTrigger>, BeanNam
Class
<?>
cronTriggerClass
;
Class
<?>
cronTriggerClass
;
Method
jobKeyMethod
;
Method
jobKeyMethod
;
try
{
try
{
cronTriggerClass
=
getClass
().
getClassLoader
().
loadClass
(
"org.quartz.impl.triggers.CronTriggerImpl"
);
cronTriggerClass
=
ClassUtils
.
forName
(
"org.quartz.impl.triggers.CronTriggerImpl"
,
getClass
().
getClassLoader
()
);
jobKeyMethod
=
JobDetail
.
class
.
getMethod
(
"getKey"
);
jobKeyMethod
=
JobDetail
.
class
.
getMethod
(
"getKey"
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
...
...
spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailFactoryBean.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -30,6 +30,7 @@ import org.springframework.beans.factory.FactoryBean;
...
@@ -30,6 +30,7 @@ import org.springframework.beans.factory.FactoryBean;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.util.ClassUtils
;
/**
/**
* A Spring {@link FactoryBean} for creating a Quartz {@link org.quartz.JobDetail}
* A Spring {@link FactoryBean} for creating a Quartz {@link org.quartz.JobDetail}
...
@@ -210,7 +211,7 @@ public class JobDetailFactoryBean
...
@@ -210,7 +211,7 @@ public class JobDetailFactoryBean
Class
<?>
jobDetailClass
;
Class
<?>
jobDetailClass
;
try
{
try
{
jobDetailClass
=
getClass
().
getClassLoader
().
loadClass
(
"org.quartz.impl.JobDetailImpl"
);
jobDetailClass
=
ClassUtils
.
forName
(
"org.quartz.impl.JobDetailImpl"
,
getClass
().
getClassLoader
()
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
jobDetailClass
=
JobDetail
.
class
;
jobDetailClass
=
JobDetail
.
class
;
...
...
spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -87,14 +87,15 @@ public class MethodInvokingJobDetailFactoryBean extends ArgumentConvertingMethod
...
@@ -87,14 +87,15 @@ public class MethodInvokingJobDetailFactoryBean extends ArgumentConvertingMethod
static
{
static
{
try
{
try
{
jobDetailImplClass
=
Class
.
forName
(
"org.quartz.impl.JobDetailImpl"
);
jobDetailImplClass
=
ClassUtils
.
forName
(
"org.quartz.impl.JobDetailImpl"
,
MethodInvokingJobDetailFactoryBean
.
class
.
getClassLoader
());
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
jobDetailImplClass
=
null
;
jobDetailImplClass
=
null
;
}
}
try
{
try
{
Class
<?>
jobExecutionContextClass
=
Class
<?>
jobExecutionContextClass
=
ClassUtils
.
forName
(
"org.quartz.JobExecutionContext"
,
QuartzJobBean
.
class
.
getClassLoader
().
loadClass
(
"org.quartz.JobExecutionContext"
);
MethodInvokingJobDetailFactoryBean
.
class
.
getClassLoader
()
);
setResultMethod
=
jobExecutionContextClass
.
getMethod
(
"setResult"
,
Object
.
class
);
setResultMethod
=
jobExecutionContextClass
.
getMethod
(
"setResult"
,
Object
.
class
);
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
...
...
spring-context-support/src/main/java/org/springframework/scheduling/quartz/QuartzJobBean.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -28,6 +28,7 @@ import org.quartz.SchedulerException;
...
@@ -28,6 +28,7 @@ import org.quartz.SchedulerException;
import
org.springframework.beans.BeanWrapper
;
import
org.springframework.beans.BeanWrapper
;
import
org.springframework.beans.MutablePropertyValues
;
import
org.springframework.beans.MutablePropertyValues
;
import
org.springframework.beans.PropertyAccessorFactory
;
import
org.springframework.beans.PropertyAccessorFactory
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.ReflectionUtils
;
/**
/**
...
@@ -77,7 +78,7 @@ public abstract class QuartzJobBean implements Job {
...
@@ -77,7 +78,7 @@ public abstract class QuartzJobBean implements Job {
static
{
static
{
try
{
try
{
Class
<?>
jobExecutionContextClass
=
Class
<?>
jobExecutionContextClass
=
QuartzJobBean
.
class
.
getClassLoader
().
loadClass
(
"org.quartz.JobExecutionContext"
);
ClassUtils
.
forName
(
"org.quartz.JobExecutionContext"
,
QuartzJobBean
.
class
.
getClassLoader
()
);
getSchedulerMethod
=
jobExecutionContextClass
.
getMethod
(
"getScheduler"
);
getSchedulerMethod
=
jobExecutionContextClass
.
getMethod
(
"getScheduler"
);
getMergedJobDataMapMethod
=
jobExecutionContextClass
.
getMethod
(
"getMergedJobDataMap"
);
getMergedJobDataMapMethod
=
jobExecutionContextClass
.
getMethod
(
"getMergedJobDataMap"
);
}
}
...
...
spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java
浏览文件 @
59cef3ce
...
@@ -43,6 +43,7 @@ import org.springframework.transaction.PlatformTransactionManager;
...
@@ -43,6 +43,7 @@ import org.springframework.transaction.PlatformTransactionManager;
import
org.springframework.transaction.TransactionException
;
import
org.springframework.transaction.TransactionException
;
import
org.springframework.transaction.TransactionStatus
;
import
org.springframework.transaction.TransactionStatus
;
import
org.springframework.transaction.support.DefaultTransactionDefinition
;
import
org.springframework.transaction.support.DefaultTransactionDefinition
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.ReflectionUtils
;
/**
/**
...
@@ -68,8 +69,8 @@ public abstract class SchedulerAccessor implements ResourceLoaderAware {
...
@@ -68,8 +69,8 @@ public abstract class SchedulerAccessor implements ResourceLoaderAware {
static
{
static
{
// Quartz 2.0 job/trigger key available?
// Quartz 2.0 job/trigger key available?
try
{
try
{
jobKeyClass
=
Class
.
forName
(
"org.quartz.JobKey"
);
jobKeyClass
=
Class
Utils
.
forName
(
"org.quartz.JobKey"
,
SchedulerAccessor
.
class
.
getClassLoader
()
);
triggerKeyClass
=
Class
.
forName
(
"org.quartz.TriggerKey"
);
triggerKeyClass
=
Class
Utils
.
forName
(
"org.quartz.TriggerKey"
,
SchedulerAccessor
.
class
.
getClassLoader
()
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
jobKeyClass
=
null
;
jobKeyClass
=
null
;
...
...
spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -33,6 +33,7 @@ import org.springframework.beans.factory.FactoryBean;
...
@@ -33,6 +33,7 @@ import org.springframework.beans.factory.FactoryBean;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.core.Constants
;
import
org.springframework.core.Constants
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.ReflectionUtils
;
/**
/**
...
@@ -252,7 +253,7 @@ public class SimpleTriggerFactoryBean implements FactoryBean<SimpleTrigger>, Bea
...
@@ -252,7 +253,7 @@ public class SimpleTriggerFactoryBean implements FactoryBean<SimpleTrigger>, Bea
Class
<?>
simpleTriggerClass
;
Class
<?>
simpleTriggerClass
;
Method
jobKeyMethod
;
Method
jobKeyMethod
;
try
{
try
{
simpleTriggerClass
=
getClass
().
getClassLoader
().
loadClass
(
"org.quartz.impl.triggers.SimpleTriggerImpl"
);
simpleTriggerClass
=
ClassUtils
.
forName
(
"org.quartz.impl.triggers.SimpleTriggerImpl"
,
getClass
().
getClassLoader
()
);
jobKeyMethod
=
JobDetail
.
class
.
getMethod
(
"getKey"
);
jobKeyMethod
=
JobDetail
.
class
.
getMethod
(
"getKey"
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
...
...
spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -226,8 +226,8 @@ public class AnnotationConfigUtils {
...
@@ -226,8 +226,8 @@ public class AnnotationConfigUtils {
if
(
jpaPresent
&&
!
registry
.
containsBeanDefinition
(
PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAME
))
{
if
(
jpaPresent
&&
!
registry
.
containsBeanDefinition
(
PERSISTENCE_ANNOTATION_PROCESSOR_BEAN_NAME
))
{
RootBeanDefinition
def
=
new
RootBeanDefinition
();
RootBeanDefinition
def
=
new
RootBeanDefinition
();
try
{
try
{
ClassLoader
cl
=
AnnotationConfigUtils
.
class
.
getClassLoader
();
def
.
setBeanClass
(
ClassUtils
.
forName
(
PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME
,
def
.
setBeanClass
(
cl
.
loadClass
(
PERSISTENCE_ANNOTATION_PROCESSOR_CLASS_NAME
));
AnnotationConfigUtils
.
class
.
getClassLoader
()
));
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
throw
new
IllegalStateException
(
throw
new
IllegalStateException
(
...
...
spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -238,7 +238,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
...
@@ -238,7 +238,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
ClassLoader
cl
=
ClassPathScanningCandidateComponentProvider
.
class
.
getClassLoader
();
ClassLoader
cl
=
ClassPathScanningCandidateComponentProvider
.
class
.
getClassLoader
();
try
{
try
{
this
.
includeFilters
.
add
(
new
AnnotationTypeFilter
(
this
.
includeFilters
.
add
(
new
AnnotationTypeFilter
(
((
Class
<?
extends
Annotation
>)
cl
.
loadClass
(
"javax.annotation.ManagedBean"
)),
false
));
((
Class
<?
extends
Annotation
>)
ClassUtils
.
forName
(
"javax.annotation.ManagedBean"
,
cl
)),
false
));
logger
.
debug
(
"JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning"
);
logger
.
debug
(
"JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning"
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
...
@@ -246,7 +246,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
...
@@ -246,7 +246,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
}
}
try
{
try
{
this
.
includeFilters
.
add
(
new
AnnotationTypeFilter
(
this
.
includeFilters
.
add
(
new
AnnotationTypeFilter
(
((
Class
<?
extends
Annotation
>)
cl
.
loadClass
(
"javax.inject.Named"
)),
false
));
((
Class
<?
extends
Annotation
>)
ClassUtils
.
forName
(
"javax.inject.Named"
,
cl
)),
false
));
logger
.
debug
(
"JSR-330 'javax.inject.Named' annotation found and supported for component scanning"
);
logger
.
debug
(
"JSR-330 'javax.inject.Named' annotation found and supported for component scanning"
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
...
...
spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -142,10 +142,10 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
...
@@ -142,10 +142,10 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
private
static
Class
<?
extends
Annotation
>
ejbRefClass
=
null
;
private
static
Class
<?
extends
Annotation
>
ejbRefClass
=
null
;
static
{
static
{
ClassLoader
cl
=
CommonAnnotationBeanPostProcessor
.
class
.
getClassLoader
();
try
{
try
{
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
Class
<?
extends
Annotation
>
clazz
=
(
Class
<?
extends
Annotation
>)
cl
.
loadClass
(
"javax.xml.ws.WebServiceRef"
);
Class
<?
extends
Annotation
>
clazz
=
(
Class
<?
extends
Annotation
>)
ClassUtils
.
forName
(
"javax.xml.ws.WebServiceRef"
,
CommonAnnotationBeanPostProcessor
.
class
.
getClassLoader
());
webServiceRefClass
=
clazz
;
webServiceRefClass
=
clazz
;
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
...
@@ -153,7 +153,8 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
...
@@ -153,7 +153,8 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
}
}
try
{
try
{
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
Class
<?
extends
Annotation
>
clazz
=
(
Class
<?
extends
Annotation
>)
cl
.
loadClass
(
"javax.ejb.EJB"
);
Class
<?
extends
Annotation
>
clazz
=
(
Class
<?
extends
Annotation
>)
ClassUtils
.
forName
(
"javax.ejb.EJB"
,
CommonAnnotationBeanPostProcessor
.
class
.
getClassLoader
());
ejbRefClass
=
clazz
;
ejbRefClass
=
clazz
;
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
...
...
spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationAdvisor.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.BeanFactory;
...
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.BeanFactory;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.core.task.SimpleAsyncTaskExecutor
;
import
org.springframework.core.task.SimpleAsyncTaskExecutor
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ClassUtils
;
/**
/**
* Advisor that activates asynchronous method execution through the {@link Async}
* Advisor that activates asynchronous method execution through the {@link Async}
...
@@ -73,9 +74,9 @@ public class AsyncAnnotationAdvisor extends AbstractPointcutAdvisor implements B
...
@@ -73,9 +74,9 @@ public class AsyncAnnotationAdvisor extends AbstractPointcutAdvisor implements B
public
AsyncAnnotationAdvisor
(
Executor
executor
)
{
public
AsyncAnnotationAdvisor
(
Executor
executor
)
{
Set
<
Class
<?
extends
Annotation
>>
asyncAnnotationTypes
=
new
LinkedHashSet
<
Class
<?
extends
Annotation
>>(
2
);
Set
<
Class
<?
extends
Annotation
>>
asyncAnnotationTypes
=
new
LinkedHashSet
<
Class
<?
extends
Annotation
>>(
2
);
asyncAnnotationTypes
.
add
(
Async
.
class
);
asyncAnnotationTypes
.
add
(
Async
.
class
);
ClassLoader
cl
=
AsyncAnnotationAdvisor
.
class
.
getClassLoader
();
try
{
try
{
asyncAnnotationTypes
.
add
((
Class
<?
extends
Annotation
>)
cl
.
loadClass
(
"javax.ejb.Asynchronous"
));
asyncAnnotationTypes
.
add
((
Class
<?
extends
Annotation
>)
ClassUtils
.
forName
(
"javax.ejb.Asynchronous"
,
AsyncAnnotationAdvisor
.
class
.
getClassLoader
()));
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
// If EJB 3.1 API not present, simply ignore.
// If EJB 3.1 API not present, simply ignore.
...
...
spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java
浏览文件 @
59cef3ce
...
@@ -42,6 +42,7 @@ import org.springframework.core.io.UrlResource;
...
@@ -42,6 +42,7 @@ import org.springframework.core.io.UrlResource;
import
org.springframework.core.io.VfsResource
;
import
org.springframework.core.io.VfsResource
;
import
org.springframework.util.AntPathMatcher
;
import
org.springframework.util.AntPathMatcher
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.PathMatcher
;
import
org.springframework.util.PathMatcher
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.ResourceUtils
;
import
org.springframework.util.ResourceUtils
;
...
@@ -143,11 +144,15 @@ import org.springframework.util.StringUtils;
...
@@ -143,11 +144,15 @@ import org.springframework.util.StringUtils;
*
*
* <p><b>WARNING:</b> Ant-style patterns with "classpath:" resources are not
* <p><b>WARNING:</b> Ant-style patterns with "classpath:" resources are not
* guaranteed to find matching resources if the root package to search is available
* guaranteed to find matching resources if the root package to search is available
* in multiple class path locations. This is because a resource such as<pre class="code">
* in multiple class path locations. This is because a resource such as
* <pre class="code">
* com/mycompany/package1/service-context.xml
* com/mycompany/package1/service-context.xml
* </pre>may be in only one location, but when a path such as<pre class="code">
* </pre>
* may be in only one location, but when a path such as
* <pre class="code">
* classpath:com/mycompany/**/service-context.xml
* classpath:com/mycompany/**/service-context.xml
* </pre>is used to try to resolve it, the resolver will work off the (first) URL
* </pre>
* is used to try to resolve it, the resolver will work off the (first) URL
* returned by {@code getResource("com/mycompany");}. If this base package
* returned by {@code getResource("com/mycompany");}. If this base package
* node exists in multiple classloader locations, the actual end resource may
* node exists in multiple classloader locations, the actual end resource may
* not be underneath. Therefore, preferably, use "{@code classpath*:}" with the same
* not be underneath. Therefore, preferably, use "{@code classpath*:}" with the same
...
@@ -171,10 +176,10 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
...
@@ -171,10 +176,10 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
private
static
Method
equinoxResolveMethod
;
private
static
Method
equinoxResolveMethod
;
static
{
static
{
// Detect Equinox OSGi (e.g. on WebSphere 6.1)
try
{
try
{
Class
<?>
fileLocatorClass
=
PathMatchingResourcePatternResolver
.
class
.
getClassLoader
().
loadClass
(
// Detect Equinox OSGi (e.g. on WebSphere 6.1)
"org.eclipse.core.runtime.FileLocator"
);
Class
<?>
fileLocatorClass
=
ClassUtils
.
forName
(
"org.eclipse.core.runtime.FileLocator"
,
PathMatchingResourcePatternResolver
.
class
.
getClassLoader
());
equinoxResolveMethod
=
fileLocatorClass
.
getMethod
(
"resolve"
,
URL
.
class
);
equinoxResolveMethod
=
fileLocatorClass
.
getMethod
(
"resolve"
,
URL
.
class
);
logger
.
debug
(
"Found Equinox FileLocator for OSGi bundle URL resolution"
);
logger
.
debug
(
"Found Equinox FileLocator for OSGi bundle URL resolution"
);
}
}
...
@@ -198,6 +203,17 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
...
@@ -198,6 +203,17 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
this
.
resourceLoader
=
new
DefaultResourceLoader
();
this
.
resourceLoader
=
new
DefaultResourceLoader
();
}
}
/**
* Create a new PathMatchingResourcePatternResolver.
* <p>ClassLoader access will happen via the thread context class loader.
* @param resourceLoader the ResourceLoader to load root directories and
* actual resources with
*/
public
PathMatchingResourcePatternResolver
(
ResourceLoader
resourceLoader
)
{
Assert
.
notNull
(
resourceLoader
,
"ResourceLoader must not be null"
);
this
.
resourceLoader
=
resourceLoader
;
}
/**
/**
* Create a new PathMatchingResourcePatternResolver with a DefaultResourceLoader.
* Create a new PathMatchingResourcePatternResolver with a DefaultResourceLoader.
* @param classLoader the ClassLoader to load classpath resources with,
* @param classLoader the ClassLoader to load classpath resources with,
...
@@ -209,16 +225,6 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
...
@@ -209,16 +225,6 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
this
.
resourceLoader
=
new
DefaultResourceLoader
(
classLoader
);
this
.
resourceLoader
=
new
DefaultResourceLoader
(
classLoader
);
}
}
/**
* Create a new PathMatchingResourcePatternResolver.
* <p>ClassLoader access will happen via the thread context class loader.
* @param resourceLoader the ResourceLoader to load root directories and
* actual resources with
*/
public
PathMatchingResourcePatternResolver
(
ResourceLoader
resourceLoader
)
{
Assert
.
notNull
(
resourceLoader
,
"ResourceLoader must not be null"
);
this
.
resourceLoader
=
resourceLoader
;
}
/**
/**
* Return the ResourceLoader that this pattern resolver works with.
* Return the ResourceLoader that this pattern resolver works with.
...
@@ -227,11 +233,6 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
...
@@ -227,11 +233,6 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
return
this
.
resourceLoader
;
return
this
.
resourceLoader
;
}
}
/**
* Return the ClassLoader that this pattern resolver works with
* (only {@code null} if even the system ClassLoader isn't accessible).
* @see org.springframework.util.ClassUtils#getDefaultClassLoader()
*/
@Override
@Override
public
ClassLoader
getClassLoader
()
{
public
ClassLoader
getClassLoader
()
{
return
getResourceLoader
().
getClassLoader
();
return
getResourceLoader
().
getClassLoader
();
...
...
spring-core/src/main/java/org/springframework/core/io/support/PropertiesLoaderUtils.java
浏览文件 @
59cef3ce
...
@@ -174,9 +174,9 @@ public abstract class PropertiesLoaderUtils {
...
@@ -174,9 +174,9 @@ public abstract class PropertiesLoaderUtils {
if
(
classLoaderToUse
==
null
)
{
if
(
classLoaderToUse
==
null
)
{
classLoaderToUse
=
ClassUtils
.
getDefaultClassLoader
();
classLoaderToUse
=
ClassUtils
.
getDefaultClassLoader
();
}
}
Properties
props
=
new
Properties
();
Enumeration
<
URL
>
urls
=
(
classLoaderToUse
!=
null
?
classLoaderToUse
.
getResources
(
resourceName
)
:
Enumeration
<
URL
>
urls
=
(
classLoaderToUse
!=
null
?
classLoaderToUse
.
getResources
(
resourceName
)
:
ClassLoader
.
getSystemResources
(
resourceName
));
ClassLoader
.
getSystemResources
(
resourceName
));
Properties
props
=
new
Properties
();
while
(
urls
.
hasMoreElements
())
{
while
(
urls
.
hasMoreElements
())
{
URL
url
=
urls
.
nextElement
();
URL
url
=
urls
.
nextElement
();
URLConnection
con
=
url
.
openConnection
();
URLConnection
con
=
url
.
openConnection
();
...
...
spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -86,9 +86,9 @@ public abstract class SpringFactoriesLoader {
...
@@ -86,9 +86,9 @@ public abstract class SpringFactoriesLoader {
public
static
List
<
String
>
loadFactoryNames
(
Class
<?>
factoryClass
,
ClassLoader
classLoader
)
{
public
static
List
<
String
>
loadFactoryNames
(
Class
<?>
factoryClass
,
ClassLoader
classLoader
)
{
String
factoryClassName
=
factoryClass
.
getName
();
String
factoryClassName
=
factoryClass
.
getName
();
try
{
try
{
List
<
String
>
result
=
new
ArrayList
<
String
>();
Enumeration
<
URL
>
urls
=
(
classLoader
!=
null
?
classLoader
.
getResources
(
FACTORIES_RESOURCE_LOCATION
)
:
Enumeration
<
URL
>
urls
=
(
classLoader
!=
null
?
classLoader
.
getResources
(
FACTORIES_RESOURCE_LOCATION
)
:
ClassLoader
.
getSystemResources
(
FACTORIES_RESOURCE_LOCATION
));
ClassLoader
.
getSystemResources
(
FACTORIES_RESOURCE_LOCATION
));
List
<
String
>
result
=
new
ArrayList
<
String
>();
while
(
urls
.
hasMoreElements
())
{
while
(
urls
.
hasMoreElements
())
{
URL
url
=
urls
.
nextElement
();
URL
url
=
urls
.
nextElement
();
Properties
properties
=
PropertiesLoaderUtils
.
loadProperties
(
new
UrlResource
(
url
));
Properties
properties
=
PropertiesLoaderUtils
.
loadProperties
(
new
UrlResource
(
url
));
...
...
spring-core/src/main/java/org/springframework/core/type/filter/AnnotationTypeFilter.java
浏览文件 @
59cef3ce
...
@@ -22,6 +22,7 @@ import java.lang.annotation.Inherited;
...
@@ -22,6 +22,7 @@ import java.lang.annotation.Inherited;
import
org.springframework.core.annotation.AnnotationUtils
;
import
org.springframework.core.annotation.AnnotationUtils
;
import
org.springframework.core.type.AnnotationMetadata
;
import
org.springframework.core.type.AnnotationMetadata
;
import
org.springframework.core.type.classreading.MetadataReader
;
import
org.springframework.core.type.classreading.MetadataReader
;
import
org.springframework.util.ClassUtils
;
/**
/**
* A simple filter which matches classes with a given annotation,
* A simple filter which matches classes with a given annotation,
...
@@ -97,14 +98,14 @@ public class AnnotationTypeFilter extends AbstractTypeHierarchyTraversingFilter
...
@@ -97,14 +98,14 @@ public class AnnotationTypeFilter extends AbstractTypeHierarchyTraversingFilter
if
(
Object
.
class
.
getName
().
equals
(
typeName
))
{
if
(
Object
.
class
.
getName
().
equals
(
typeName
))
{
return
false
;
return
false
;
}
}
else
if
(
typeName
.
startsWith
(
"java
.
"
))
{
else
if
(
typeName
.
startsWith
(
"java"
))
{
try
{
try
{
Class
<?>
clazz
=
getClass
().
getClassLoader
().
loadClass
(
typeName
);
Class
<?>
clazz
=
ClassUtils
.
forName
(
typeName
,
getClass
().
getClassLoader
()
);
return
((
this
.
considerMetaAnnotations
?
AnnotationUtils
.
getAnnotation
(
clazz
,
this
.
annotationType
)
:
return
((
this
.
considerMetaAnnotations
?
AnnotationUtils
.
getAnnotation
(
clazz
,
this
.
annotationType
)
:
clazz
.
getAnnotation
(
this
.
annotationType
))
!=
null
);
clazz
.
getAnnotation
(
this
.
annotationType
))
!=
null
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
Throwable
ex
)
{
// Class not
found
- can't determine a match that way.
// Class not
regularly loadable
- can't determine a match that way.
}
}
}
}
return
null
;
return
null
;
...
...
spring-core/src/main/java/org/springframework/core/type/filter/AssignableTypeFilter.java
浏览文件 @
59cef3ce
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
package
org.springframework.core.type.filter
;
package
org.springframework.core.type.filter
;
import
org.springframework.util.ClassUtils
;
/**
/**
* A simple filter which matches classes that are assignable to a given type.
* A simple filter which matches classes that are assignable to a given type.
*
*
...
@@ -61,13 +63,13 @@ public class AssignableTypeFilter extends AbstractTypeHierarchyTraversingFilter
...
@@ -61,13 +63,13 @@ public class AssignableTypeFilter extends AbstractTypeHierarchyTraversingFilter
else
if
(
Object
.
class
.
getName
().
equals
(
typeName
))
{
else
if
(
Object
.
class
.
getName
().
equals
(
typeName
))
{
return
false
;
return
false
;
}
}
else
if
(
typeName
.
startsWith
(
"java
.
"
))
{
else
if
(
typeName
.
startsWith
(
"java"
))
{
try
{
try
{
Class
<?>
clazz
=
getClass
().
getClassLoader
().
loadClass
(
typeName
);
Class
<?>
clazz
=
ClassUtils
.
forName
(
typeName
,
getClass
().
getClassLoader
()
);
return
this
.
targetType
.
isAssignableFrom
(
clazz
);
return
this
.
targetType
.
isAssignableFrom
(
clazz
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
Throwable
ex
)
{
// Class not
found
- can't determine a match that way.
// Class not
regularly loadable
- can't determine a match that way.
}
}
}
}
return
null
;
return
null
;
...
...
spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeLocator.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -98,7 +98,7 @@ public class StandardTypeLocator implements TypeLocator {
...
@@ -98,7 +98,7 @@ public class StandardTypeLocator implements TypeLocator {
public
Class
<?>
findType
(
String
typeName
)
throws
EvaluationException
{
public
Class
<?>
findType
(
String
typeName
)
throws
EvaluationException
{
String
nameToLookup
=
typeName
;
String
nameToLookup
=
typeName
;
try
{
try
{
return
this
.
classLoader
.
loadClass
(
nameToLookup
);
return
ClassUtils
.
forName
(
nameToLookup
,
this
.
classLoader
);
}
}
catch
(
ClassNotFoundException
ey
)
{
catch
(
ClassNotFoundException
ey
)
{
// try any registered prefixes before giving up
// try any registered prefixes before giving up
...
@@ -106,7 +106,7 @@ public class StandardTypeLocator implements TypeLocator {
...
@@ -106,7 +106,7 @@ public class StandardTypeLocator implements TypeLocator {
for
(
String
prefix
:
this
.
knownPackagePrefixes
)
{
for
(
String
prefix
:
this
.
knownPackagePrefixes
)
{
try
{
try
{
nameToLookup
=
prefix
+
"."
+
typeName
;
nameToLookup
=
prefix
+
"."
+
typeName
;
return
this
.
classLoader
.
loadClass
(
nameToLookup
);
return
ClassUtils
.
forName
(
nameToLookup
,
this
.
classLoader
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
// might be a different prefix
// might be a different prefix
...
...
spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -18,7 +18,6 @@ package org.springframework.jdbc.core;
...
@@ -18,7 +18,6 @@ package org.springframework.jdbc.core;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
javax.sql.rowset.CachedRowSet
;
import
javax.sql.rowset.CachedRowSet
;
import
javax.sql.rowset.RowSetFactory
;
import
javax.sql.rowset.RowSetFactory
;
import
javax.sql.rowset.RowSetProvider
;
import
javax.sql.rowset.RowSetProvider
;
...
@@ -26,6 +25,7 @@ import javax.sql.rowset.RowSetProvider;
...
@@ -26,6 +25,7 @@ import javax.sql.rowset.RowSetProvider;
import
org.springframework.core.JdkVersion
;
import
org.springframework.core.JdkVersion
;
import
org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet
;
import
org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet
;
import
org.springframework.jdbc.support.rowset.SqlRowSet
;
import
org.springframework.jdbc.support.rowset.SqlRowSet
;
import
org.springframework.util.ClassUtils
;
/**
/**
* {@link ResultSetExtractor} implementation that returns a Spring {@link SqlRowSet}
* {@link ResultSetExtractor} implementation that returns a Spring {@link SqlRowSet}
...
@@ -134,12 +134,14 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet
...
@@ -134,12 +134,14 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet
*/
*/
private
static
class
SunCachedRowSetFactory
implements
CachedRowSetFactory
{
private
static
class
SunCachedRowSetFactory
implements
CachedRowSetFactory
{
private
static
final
Class
<?>
IMPLEMENTATION_CLASS
;
private
static
final
Class
<?>
implementationClass
;
static
{
static
{
try
{
try
{
IMPLEMENTATION_CLASS
=
Class
.
forName
(
"com.sun.rowset.CachedRowSetImpl"
);
implementationClass
=
ClassUtils
.
forName
(
"com.sun.rowset.CachedRowSetImpl"
,
SqlRowSetResultSetExtractor
.
class
.
getClassLoader
());
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
Throwable
ex
)
{
throw
new
IllegalStateException
(
ex
);
throw
new
IllegalStateException
(
ex
);
}
}
}
}
...
@@ -147,12 +149,9 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet
...
@@ -147,12 +149,9 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet
@Override
@Override
public
CachedRowSet
createCachedRowSet
()
throws
SQLException
{
public
CachedRowSet
createCachedRowSet
()
throws
SQLException
{
try
{
try
{
return
(
CachedRowSet
)
IMPLEMENTATION_CLASS
.
newInstance
();
return
(
CachedRowSet
)
implementationClass
.
newInstance
();
}
catch
(
InstantiationException
ex
)
{
throw
new
IllegalStateException
(
ex
);
}
}
catch
(
IllegalAccessException
ex
)
{
catch
(
Throwable
ex
)
{
throw
new
IllegalStateException
(
ex
);
throw
new
IllegalStateException
(
ex
);
}
}
}
}
...
...
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/OracleTableMetaDataProvider.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -56,9 +56,10 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
...
@@ -56,9 +56,10 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
lookupDefaultSchema
(
databaseMetaData
);
lookupDefaultSchema
(
databaseMetaData
);
}
}
@Override
@Override
protected
String
getDefaultSchema
()
{
protected
String
getDefaultSchema
()
{
if
(
defaultSchema
!=
null
)
{
if
(
this
.
defaultSchema
!=
null
)
{
return
defaultSchema
;
return
defaultSchema
;
}
}
return
super
.
getDefaultSchema
();
return
super
.
getDefaultSchema
();
...
@@ -81,7 +82,7 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
...
@@ -81,7 +82,7 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
}
}
boolean
isOracleCon
;
boolean
isOracleCon
;
try
{
try
{
Class
<?>
oracleConClass
=
getClass
().
getClassLoader
().
loadClass
(
"oracle.jdbc.OracleConnection"
);
Class
<?>
oracleConClass
=
con
.
getClass
().
getClassLoader
().
loadClass
(
"oracle.jdbc.OracleConnection"
);
isOracleCon
=
oracleConClass
.
isInstance
(
con
);
isOracleCon
=
oracleConClass
.
isInstance
(
con
);
}
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
ClassNotFoundException
ex
)
{
...
@@ -107,7 +108,7 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
...
@@ -107,7 +108,7 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
ReflectionUtils
.
makeAccessible
(
getIncludeSynonyms
);
ReflectionUtils
.
makeAccessible
(
getIncludeSynonyms
);
originalValueForIncludeSynonyms
=
(
Boolean
)
getIncludeSynonyms
.
invoke
(
con
);
originalValueForIncludeSynonyms
=
(
Boolean
)
getIncludeSynonyms
.
invoke
(
con
);
setIncludeSynonyms
=
con
.
getClass
().
getMethod
(
"setIncludeSynonyms"
,
new
Class
<?>[]
{
boolean
.
class
}
);
setIncludeSynonyms
=
con
.
getClass
().
getMethod
(
"setIncludeSynonyms"
,
boolean
.
class
);
ReflectionUtils
.
makeAccessible
(
setIncludeSynonyms
);
ReflectionUtils
.
makeAccessible
(
setIncludeSynonyms
);
setIncludeSynonyms
.
invoke
(
con
,
Boolean
.
TRUE
);
setIncludeSynonyms
.
invoke
(
con
,
Boolean
.
TRUE
);
}
}
...
@@ -126,8 +127,7 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
...
@@ -126,8 +127,7 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
}
}
/*
/*
* Oracle implementation for detecting current schema
* Oracle-based implementation for detecting the current schema.
*
* @param databaseMetaData
* @param databaseMetaData
*/
*/
private
void
lookupDefaultSchema
(
DatabaseMetaData
databaseMetaData
)
{
private
void
lookupDefaultSchema
(
DatabaseMetaData
databaseMetaData
)
{
...
@@ -144,7 +144,9 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
...
@@ -144,7 +144,9 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
cstmt
.
close
();
cstmt
.
close
();
}
}
}
}
}
catch
(
Exception
ignore
)
{}
}
catch
(
Exception
ignore
)
{
}
}
}
}
}
spring-test/src/main/java/org/springframework/test/context/TestContextManager.java
浏览文件 @
59cef3ce
...
@@ -26,11 +26,13 @@ import java.util.Set;
...
@@ -26,11 +26,13 @@ import java.util.Set;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.core.annotation.AnnotationAttributes
;
import
org.springframework.core.annotation.AnnotationAttributes
;
import
org.springframework.test.context.MetaAnnotationUtils.
AnnotationDescriptor
;
import
org.springframework.test.context.MetaAnnotationUtils.
*
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
static
org
.
springframework
.
test
.
context
.
MetaAnnotationUtils
.*;
import
static
org
.
springframework
.
test
.
context
.
MetaAnnotationUtils
.*;
...
@@ -159,8 +161,7 @@ public class TestContextManager {
...
@@ -159,8 +161,7 @@ public class TestContextManager {
* registered for this {@code TestContextManager} in reverse order.
* registered for this {@code TestContextManager} in reverse order.
*/
*/
private
List
<
TestExecutionListener
>
getReversedTestExecutionListeners
()
{
private
List
<
TestExecutionListener
>
getReversedTestExecutionListeners
()
{
List
<
TestExecutionListener
>
listenersReversed
=
new
ArrayList
<
TestExecutionListener
>(
List
<
TestExecutionListener
>
listenersReversed
=
new
ArrayList
<
TestExecutionListener
>(
getTestExecutionListeners
());
getTestExecutionListeners
());
Collections
.
reverse
(
listenersReversed
);
Collections
.
reverse
(
listenersReversed
);
return
listenersReversed
;
return
listenersReversed
;
}
}
...
@@ -234,9 +235,9 @@ public class TestContextManager {
...
@@ -234,9 +235,9 @@ public class TestContextManager {
}
}
catch
(
NoClassDefFoundError
err
)
{
catch
(
NoClassDefFoundError
err
)
{
if
(
logger
.
isInfoEnabled
())
{
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
String
.
format
(
"Could not instantiate TestExecutionListener class [%s]. "
logger
.
info
(
String
.
format
(
"Could not instantiate TestExecutionListener class [%s]. "
+
+
"Specify custom listener classes or make the default listener classes "
"Specify custom listener classes or make the default listener classes "
+
+
"(and their dependencies) available."
,
listenerClass
.
getName
()));
"(and their dependencies) available."
,
listenerClass
.
getName
()));
}
}
}
}
}
}
...
@@ -252,15 +253,15 @@ public class TestContextManager {
...
@@ -252,15 +253,15 @@ public class TestContextManager {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
protected
Set
<
Class
<?
extends
TestExecutionListener
>>
getDefaultTestExecutionListenerClasses
()
{
protected
Set
<
Class
<?
extends
TestExecutionListener
>>
getDefaultTestExecutionListenerClasses
()
{
Set
<
Class
<?
extends
TestExecutionListener
>>
defaultListenerClasses
=
new
LinkedHashSet
<
Class
<?
extends
TestExecutionListener
>>();
Set
<
Class
<?
extends
TestExecutionListener
>>
defaultListenerClasses
=
new
LinkedHashSet
<
Class
<?
extends
TestExecutionListener
>>();
ClassLoader
cl
=
getClass
().
getClassLoader
();
for
(
String
className
:
DEFAULT_TEST_EXECUTION_LISTENER_CLASS_NAMES
)
{
for
(
String
className
:
DEFAULT_TEST_EXECUTION_LISTENER_CLASS_NAMES
)
{
try
{
try
{
defaultListenerClasses
.
add
((
Class
<?
extends
TestExecutionListener
>)
getClass
().
getClassLoader
().
loadClass
(
defaultListenerClasses
.
add
((
Class
<?
extends
TestExecutionListener
>)
ClassUtils
.
forName
(
className
,
cl
));
className
));
}
}
catch
(
Throwable
t
)
{
catch
(
Throwable
ex
)
{
if
(
logger
.
isDebugEnabled
())
{
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"Could not load default TestExecutionListener class ["
+
className
logger
.
debug
(
"Could not load default TestExecutionListener class ["
+
className
+
+
"]. Specify custom listener classes or make the default listener classes available."
,
t
);
"]. Specify custom listener classes or make the default listener classes available."
,
ex
);
}
}
}
}
}
}
...
@@ -281,7 +282,7 @@ public class TestContextManager {
...
@@ -281,7 +282,7 @@ public class TestContextManager {
* @see #getTestExecutionListeners()
* @see #getTestExecutionListeners()
*/
*/
public
void
beforeTestClass
()
throws
Exception
{
public
void
beforeTestClass
()
throws
Exception
{
final
Class
<?>
testClass
=
getTestContext
().
getTestClass
();
Class
<?>
testClass
=
getTestContext
().
getTestClass
();
if
(
logger
.
isTraceEnabled
())
{
if
(
logger
.
isTraceEnabled
())
{
logger
.
trace
(
"beforeTestClass(): class ["
+
testClass
+
"]"
);
logger
.
trace
(
"beforeTestClass(): class ["
+
testClass
+
"]"
);
}
}
...
@@ -292,8 +293,8 @@ public class TestContextManager {
...
@@ -292,8 +293,8 @@ public class TestContextManager {
testExecutionListener
.
beforeTestClass
(
getTestContext
());
testExecutionListener
.
beforeTestClass
(
getTestContext
());
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
logger
.
warn
(
"Caught exception while allowing TestExecutionListener ["
+
testExecutionListener
logger
.
warn
(
"Caught exception while allowing TestExecutionListener ["
+
testExecutionListener
+
+
"] to process 'before class' callback for test class ["
+
testClass
+
"]"
,
ex
);
"] to process 'before class' callback for test class ["
+
testClass
+
"]"
,
ex
);
throw
ex
;
throw
ex
;
}
}
}
}
...
@@ -325,8 +326,8 @@ public class TestContextManager {
...
@@ -325,8 +326,8 @@ public class TestContextManager {
testExecutionListener
.
prepareTestInstance
(
getTestContext
());
testExecutionListener
.
prepareTestInstance
(
getTestContext
());
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
logger
.
error
(
"Caught exception while allowing TestExecutionListener ["
+
testExecutionListener
logger
.
error
(
"Caught exception while allowing TestExecutionListener ["
+
testExecutionListener
+
+
"] to prepare test instance ["
+
testInstance
+
"]"
,
ex
);
"] to prepare test instance ["
+
testInstance
+
"]"
,
ex
);
throw
ex
;
throw
ex
;
}
}
}
}
...
@@ -362,9 +363,9 @@ public class TestContextManager {
...
@@ -362,9 +363,9 @@ public class TestContextManager {
testExecutionListener
.
beforeTestMethod
(
getTestContext
());
testExecutionListener
.
beforeTestMethod
(
getTestContext
());
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
logger
.
warn
(
"Caught exception while allowing TestExecutionListener ["
+
testExecutionListener
logger
.
warn
(
"Caught exception while allowing TestExecutionListener ["
+
testExecutionListener
+
+
"] to process 'before' execution of test method ["
+
testMethod
+
"] for test instance ["
"] to process 'before' execution of test method ["
+
testMethod
+
"] for test instance ["
+
+
testInstance
+
"]"
,
ex
);
testInstance
+
"]"
,
ex
);
throw
ex
;
throw
ex
;
}
}
}
}
...
@@ -410,9 +411,9 @@ public class TestContextManager {
...
@@ -410,9 +411,9 @@ public class TestContextManager {
testExecutionListener
.
afterTestMethod
(
getTestContext
());
testExecutionListener
.
afterTestMethod
(
getTestContext
());
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
logger
.
warn
(
"Caught exception while allowing TestExecutionListener ["
+
testExecutionListener
logger
.
warn
(
"Caught exception while allowing TestExecutionListener ["
+
testExecutionListener
+
+
"] to process 'after' execution for test: method ["
+
testMethod
+
"], instance ["
"] to process 'after' execution for test: method ["
+
testMethod
+
"], instance ["
+
+
testInstance
+
"], exception ["
+
exception
+
"]"
,
ex
);
testInstance
+
"], exception ["
+
exception
+
"]"
,
ex
);
if
(
afterTestMethodException
==
null
)
{
if
(
afterTestMethodException
==
null
)
{
afterTestMethodException
=
ex
;
afterTestMethodException
=
ex
;
}
}
...
@@ -438,7 +439,7 @@ public class TestContextManager {
...
@@ -438,7 +439,7 @@ public class TestContextManager {
* @see #getTestExecutionListeners()
* @see #getTestExecutionListeners()
*/
*/
public
void
afterTestClass
()
throws
Exception
{
public
void
afterTestClass
()
throws
Exception
{
final
Class
<?>
testClass
=
getTestContext
().
getTestClass
();
Class
<?>
testClass
=
getTestContext
().
getTestClass
();
if
(
logger
.
isTraceEnabled
())
{
if
(
logger
.
isTraceEnabled
())
{
logger
.
trace
(
"afterTestClass(): class ["
+
testClass
+
"]"
);
logger
.
trace
(
"afterTestClass(): class ["
+
testClass
+
"]"
);
}
}
...
@@ -452,8 +453,8 @@ public class TestContextManager {
...
@@ -452,8 +453,8 @@ public class TestContextManager {
testExecutionListener
.
afterTestClass
(
getTestContext
());
testExecutionListener
.
afterTestClass
(
getTestContext
());
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
logger
.
warn
(
"Caught exception while allowing TestExecutionListener ["
+
testExecutionListener
logger
.
warn
(
"Caught exception while allowing TestExecutionListener ["
+
testExecutionListener
+
+
"] to process 'after class' callback for test class ["
+
testClass
+
"]"
,
ex
);
"] to process 'after class' callback for test class ["
+
testClass
+
"]"
,
ex
);
if
(
afterTestClassException
==
null
)
{
if
(
afterTestClassException
==
null
)
{
afterTestClassException
=
ex
;
afterTestClassException
=
ex
;
}
}
...
...
spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointExporter.java
浏览文件 @
59cef3ce
/*
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -35,6 +35,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
...
@@ -35,6 +35,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.ReflectionUtils
;
/**
/**
...
@@ -50,7 +51,6 @@ import org.springframework.util.ReflectionUtils;
...
@@ -50,7 +51,6 @@ import org.springframework.util.ReflectionUtils;
*
*
* @author Rossen Stoyanchev
* @author Rossen Stoyanchev
* @since 4.0
* @since 4.0
*
* @see ServerEndpointRegistration
* @see ServerEndpointRegistration
* @see SpringConfigurator
* @see SpringConfigurator
* @see ServletServerContainerFactoryBean
* @see ServletServerContainerFactoryBean
...
@@ -97,9 +97,9 @@ public class ServerEndpointExporter implements InitializingBean, BeanPostProcess
...
@@ -97,9 +97,9 @@ public class ServerEndpointExporter implements InitializingBean, BeanPostProcess
protected
ServerContainer
getServerContainer
()
{
protected
ServerContainer
getServerContainer
()
{
Class
<?>
servletContextClass
;
Class
<?>
servletContextClass
;
try
{
try
{
servletContextClass
=
Class
.
forName
(
"javax.servlet.ServletContext"
);
servletContextClass
=
Class
Utils
.
forName
(
"javax.servlet.ServletContext"
,
getClass
().
getClassLoader
()
);
}
}
catch
(
Throwable
e
)
{
catch
(
Throwable
e
x
)
{
return
null
;
return
null
;
}
}
...
@@ -139,8 +139,8 @@ public class ServerEndpointExporter implements InitializingBean, BeanPostProcess
...
@@ -139,8 +139,8 @@ public class ServerEndpointExporter implements InitializingBean, BeanPostProcess
ServerEndpointConfig
sec
=
(
ServerEndpointConfig
)
bean
;
ServerEndpointConfig
sec
=
(
ServerEndpointConfig
)
bean
;
try
{
try
{
if
(
logger
.
isInfoEnabled
())
{
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
"Registering bean '"
+
beanName
logger
.
info
(
"Registering bean '"
+
beanName
+
+
"' as javax.websocket.Endpoint under path "
+
sec
.
getPath
());
"' as javax.websocket.Endpoint under path "
+
sec
.
getPath
());
}
}
getServerContainer
().
addEndpoint
(
sec
);
getServerContainer
().
addEndpoint
(
sec
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录