Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
ce4e795f
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 搜索 >>
提交
ce4e795f
编写于
5月 11, 2015
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
0cd7fed0
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
133 addition
and
115 deletion
+133
-115
spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java
...pringframework/aop/aspectj/AspectJExpressionPointcut.java
+2
-3
spring-context/src/main/java/org/springframework/cache/Cache.java
...ontext/src/main/java/org/springframework/cache/Cache.java
+3
-3
spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java
...a/org/springframework/cache/annotation/EnableCaching.java
+7
-7
spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java
...springframework/scripting/groovy/GroovyScriptFactory.java
+2
-3
spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java
...amework/scripting/support/ScriptFactoryPostProcessor.java
+11
-12
spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java
...factory/support/InjectAnnotationAutowireContextTests.java
+7
-7
spring-core/src/main/java/org/springframework/util/ReflectionUtils.java
...c/main/java/org/springframework/util/ReflectionUtils.java
+5
-4
spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java
...va/org/springframework/core/GenericTypeResolverTests.java
+7
-7
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java
...ework/jdbc/core/metadata/CallMetaDataProviderFactory.java
+10
-9
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java
...work/jdbc/core/metadata/GenericTableMetaDataProvider.java
+9
-19
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java
...ingframework/jdbc/core/metadata/TableMetaDataContext.java
+11
-10
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java
...work/jdbc/core/metadata/TableMetaDataProviderFactory.java
+3
-2
spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java
...ngframework/messaging/simp/stomp/StompHeaderAccessor.java
+17
-16
spring-web/src/main/java/org/springframework/http/StreamingHttpOutputMessage.java
.../org/springframework/http/StreamingHttpOutputMessage.java
+6
-6
spring-web/src/main/java/org/springframework/web/multipart/MaxUploadSizeExceededException.java
...amework/web/multipart/MaxUploadSizeExceededException.java
+2
-2
spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderTests.java
...framework/web/bind/support/WebRequestDataBinderTests.java
+23
-1
spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java
.../springframework/web/servlet/NoHandlerFoundException.java
+8
-4
未找到文件。
spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -203,8 +203,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
pointcutParameters
[
i
]
=
parser
.
createPointcutParameter
(
this
.
pointcutParameterNames
[
i
],
this
.
pointcutParameterTypes
[
i
]);
}
return
parser
.
parsePointcutExpression
(
replaceBooleanOperators
(
getExpression
()),
return
parser
.
parsePointcutExpression
(
replaceBooleanOperators
(
getExpression
()),
this
.
pointcutDeclarationScope
,
pointcutParameters
);
}
...
...
spring-context/src/main/java/org/springframework/cache/Cache.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
5
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -17,7 +17,7 @@
package
org.springframework.cache
;
/**
* Interface that defines
the
common cache operations.
* Interface that defines common cache operations.
*
* <b>Note:</b> Due to the generic use of caching, it is recommended that
* implementations allow storage of <tt>null</tt> values (for example to
...
...
@@ -68,8 +68,8 @@ public interface Cache {
* the cache contains no mapping for this key
* @throws IllegalStateException if a cache entry has been found
* but failed to match the specified type
* @see #get(Object)
* @since 4.0
* @see #get(Object)
*/
<
T
>
T
get
(
Object
key
,
Class
<
T
>
type
);
...
...
spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -162,13 +162,12 @@ public @interface EnableCaching {
* Indicate whether subclass-based (CGLIB) proxies are to be created as opposed
* to standard Java interface-based proxies. The default is {@code false}. <strong>
* Applicable only if {@link #mode()} is set to {@link AdviceMode#PROXY}</strong>.
*
* <p>Note that setting this attribute to {@code true} will affect <em>all</em>
* Spring-managed beans requiring proxying, not just those marked with
*
{@code @Cacheable}. For example, other beans marked with Spring's
*
{@code @Transactional} annotation will be upgraded to subclass proxying at the sam
e
*
time. This approach has no negative impact in practice unless one is explicitly
* e
xpecting one type of proxy vs another, e
.g. in tests.
* Spring-managed beans requiring proxying, not just those marked with
{@code @Cacheable}.
*
For example, other beans marked with Spring's {@code @Transactional} annotation will
*
be upgraded to subclass proxying at the same time. This approach has no negativ
e
*
impact in practice unless one is explicitly expecting one type of proxy vs another,
* e.g. in tests.
*/
boolean
proxyTargetClass
()
default
false
;
...
...
@@ -185,4 +184,5 @@ public @interface EnableCaching {
* The default is {@link Ordered#LOWEST_PRECEDENCE}.
*/
int
order
()
default
Ordered
.
LOWEST_PRECEDENCE
;
}
spring-context/src/main/java/org/springframework/scripting/groovy/GroovyScriptFactory.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -24,7 +24,6 @@ import groovy.lang.MetaClass;
import
groovy.lang.Script
;
import
org.codehaus.groovy.control.CompilationFailedException
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanClassLoaderAware
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
...
...
@@ -102,7 +101,7 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
{
if
(
beanFactory
instanceof
ConfigurableListableBeanFactory
)
{
((
ConfigurableListableBeanFactory
)
beanFactory
).
ignoreDependencyType
(
MetaClass
.
class
);
}
...
...
spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -94,7 +94,7 @@ import org.springframework.util.StringUtils;
* <property name="message" value="Hello World!"/>
* </bean>
*
* <bean id="groovyMessenger" class="org.springframework.scripting.
bsh
.GroovyScriptFactory">
* <bean id="groovyMessenger" class="org.springframework.scripting.
groovy
.GroovyScriptFactory">
* <constructor-arg value="classpath:mypackage/Messenger.groovy"/>
* <property name="message" value="Hello World!"/>
* </bean></pre>
...
...
@@ -346,17 +346,16 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
* @param scriptedObjectBeanName the name of the internal scripted object bean
*/
protected
void
prepareScriptBeans
(
BeanDefinition
bd
,
String
scriptFactoryBeanName
,
String
scriptedObjectBeanName
)
{
// Avoid recreation of the script bean definition in case of a prototype.
synchronized
(
this
.
scriptBeanFactory
)
{
if
(!
this
.
scriptBeanFactory
.
containsBeanDefinition
(
scriptedObjectBeanName
))
{
this
.
scriptBeanFactory
.
registerBeanDefinition
(
scriptFactoryBeanName
,
createScriptFactoryBeanDefinition
(
bd
));
ScriptFactory
scriptFactory
=
this
.
scriptBeanFactory
.
getBean
(
scriptFactoryBeanName
,
ScriptFactory
.
class
);
ScriptSource
scriptSource
=
getScriptSource
(
scriptFactoryBeanName
,
scriptFactory
.
getScriptSourceLocator
());
this
.
scriptBeanFactory
.
registerBeanDefinition
(
scriptFactoryBeanName
,
createScriptFactoryBeanDefinition
(
bd
));
ScriptFactory
scriptFactory
=
this
.
scriptBeanFactory
.
getBean
(
scriptFactoryBeanName
,
ScriptFactory
.
class
);
ScriptSource
scriptSource
=
getScriptSource
(
scriptFactoryBeanName
,
scriptFactory
.
getScriptSourceLocator
());
Class
<?>[]
interfaces
=
scriptFactory
.
getScriptInterfaces
();
Class
<?>[]
scriptedInterfaces
=
interfaces
;
...
...
@@ -365,8 +364,8 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
scriptedInterfaces
=
ObjectUtils
.
addObjectToArray
(
interfaces
,
configInterface
);
}
BeanDefinition
objectBd
=
createScriptedObjectBeanDefinition
(
bd
,
scriptFactoryBeanName
,
scriptSource
,
scriptedInterfaces
);
BeanDefinition
objectBd
=
createScriptedObjectBeanDefinition
(
bd
,
scriptFactoryBeanName
,
scriptSource
,
scriptedInterfaces
);
long
refreshCheckDelay
=
resolveRefreshCheckDelay
(
bd
);
if
(
refreshCheckDelay
>=
0
)
{
objectBd
.
setScope
(
BeanDefinition
.
SCOPE_PROTOTYPE
);
...
...
@@ -569,7 +568,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
proxyFactory
.
setInterfaces
(
interfaces
);
if
(
proxyTargetClass
)
{
classLoader
=
null
;
// force use of Class.getClassLoader()
proxyFactory
.
setProxyTargetClass
(
proxyTargetClass
);
proxyFactory
.
setProxyTargetClass
(
true
);
}
DelegatingIntroductionInterceptor
introduction
=
new
DelegatingIntroductionInterceptor
(
ts
);
...
...
spring-context/src/test/java/org/springframework/beans/factory/support/InjectAnnotationAutowireContextTests.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -667,27 +667,27 @@ public class InjectAnnotationAutowireContextTests {
@Target
({
ElementType
.
FIELD
,
ElementType
.
PARAMETER
,
ElementType
.
TYPE
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Qualifier
public
static
@interface
TestQualifier
{
public
@interface
TestQualifier
{
}
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Qualifier
public
static
@interface
TestQualifierWithDefaultValue
{
public
@interface
TestQualifierWithDefaultValue
{
public
abstract
String
value
()
default
"default"
;
String
value
()
default
"default"
;
}
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Qualifier
public
static
@interface
TestQualifierWithMultipleAttributes
{
public
@interface
TestQualifierWithMultipleAttributes
{
public
abstract
String
value
()
default
"default"
;
String
value
()
default
"default"
;
public
abstract
int
number
();
int
number
();
}
}
spring-core/src/main/java/org/springframework/util/ReflectionUtils.java
浏览文件 @
ce4e795f
...
...
@@ -84,7 +84,8 @@ public abstract class ReflectionUtils {
while
(!
Object
.
class
.
equals
(
searchType
)
&&
searchType
!=
null
)
{
Field
[]
fields
=
searchType
.
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
if
((
name
==
null
||
name
.
equals
(
field
.
getName
()))
&&
(
type
==
null
||
type
.
equals
(
field
.
getType
())))
{
if
((
name
==
null
||
name
.
equals
(
field
.
getName
()))
&&
(
type
==
null
||
type
.
equals
(
field
.
getType
())))
{
return
field
;
}
}
...
...
@@ -410,8 +411,7 @@ public abstract class ReflectionUtils {
i
--;
}
return
((
i
>
CGLIB_RENAMED_METHOD_PREFIX
.
length
())
&&
(
i
<
name
.
length
()
-
1
)
&&
(
name
.
charAt
(
i
)
==
'$'
));
(
i
<
name
.
length
()
-
1
)
&&
name
.
charAt
(
i
)
==
'$'
);
}
return
false
;
}
...
...
@@ -425,7 +425,8 @@ public abstract class ReflectionUtils {
* @see java.lang.reflect.Field#setAccessible
*/
public
static
void
makeAccessible
(
Field
field
)
{
if
((!
Modifier
.
isPublic
(
field
.
getModifiers
())
||
!
Modifier
.
isPublic
(
field
.
getDeclaringClass
().
getModifiers
())
||
if
((!
Modifier
.
isPublic
(
field
.
getModifiers
())
||
!
Modifier
.
isPublic
(
field
.
getDeclaringClass
().
getModifiers
())
||
Modifier
.
isFinal
(
field
.
getModifiers
()))
&&
!
field
.
isAccessible
())
{
field
.
setAccessible
(
true
);
}
...
...
spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -67,12 +67,12 @@ public class GenericTypeResolverTests {
@Test
public
void
methodReturnTypes
()
{
assertEquals
(
Integer
.
class
,
resolveReturnTypeArgument
(
findMethod
(
MyTypeWithMethods
.
class
,
"integer"
),
MyInterfaceType
.
class
));
resolveReturnTypeArgument
(
findMethod
(
MyTypeWithMethods
.
class
,
"integer"
),
MyInterfaceType
.
class
));
assertEquals
(
String
.
class
,
resolveReturnTypeArgument
(
findMethod
(
MyTypeWithMethods
.
class
,
"string"
),
MyInterfaceType
.
class
));
resolveReturnTypeArgument
(
findMethod
(
MyTypeWithMethods
.
class
,
"string"
),
MyInterfaceType
.
class
));
assertEquals
(
null
,
resolveReturnTypeArgument
(
findMethod
(
MyTypeWithMethods
.
class
,
"raw"
),
MyInterfaceType
.
class
));
assertEquals
(
null
,
resolveReturnTypeArgument
(
findMethod
(
MyTypeWithMethods
.
class
,
"object"
),
MyInterfaceType
.
class
));
resolveReturnTypeArgument
(
findMethod
(
MyTypeWithMethods
.
class
,
"object"
),
MyInterfaceType
.
class
));
}
@Test
...
...
@@ -81,13 +81,13 @@ public class GenericTypeResolverTests {
Method
intMessageMethod
=
findMethod
(
MyTypeWithMethods
.
class
,
"readIntegerInputMessage"
,
MyInterfaceType
.
class
);
MethodParameter
intMessageMethodParam
=
new
MethodParameter
(
intMessageMethod
,
0
);
assertEquals
(
MyInterfaceType
.
class
,
resolveType
(
intMessageMethodParam
.
getGenericParameterType
(),
new
HashMap
<
TypeVariable
,
Type
>()));
resolveType
(
intMessageMethodParam
.
getGenericParameterType
(),
new
HashMap
<
TypeVariable
,
Type
>()));
Method
intArrMessageMethod
=
findMethod
(
MyTypeWithMethods
.
class
,
"readIntegerArrayInputMessage"
,
MyInterfaceType
[].
class
);
MyInterfaceType
[].
class
);
MethodParameter
intArrMessageMethodParam
=
new
MethodParameter
(
intArrMessageMethod
,
0
);
assertEquals
(
MyInterfaceType
[].
class
,
resolveType
(
intArrMessageMethodParam
.
getGenericParameterType
(),
new
HashMap
<
TypeVariable
,
Type
>()));
resolveType
(
intArrMessageMethodParam
.
getGenericParameterType
(),
new
HashMap
<
TypeVariable
,
Type
>()));
Method
genericArrMessageMethod
=
findMethod
(
MySimpleTypeWithMethods
.
class
,
"readGenericArrayInputMessage"
,
Object
[].
class
);
...
...
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataProviderFactory.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -31,16 +31,14 @@ import org.springframework.jdbc.support.JdbcUtils;
import
org.springframework.jdbc.support.MetaDataAccessException
;
/**
* Factory used to create a {@link CallMetaDataProvider} implementation based on the type of databse being used.
* Factory used to create a {@link CallMetaDataProvider} implementation
* based on the type of databse being used.
*
* @author Thomas Risberg
* @since 2.5
*/
public
class
CallMetaDataProviderFactory
{
/** Logger */
private
static
final
Log
logger
=
LogFactory
.
getLog
(
CallMetaDataProviderFactory
.
class
);
/** List of supported database products for procedure calls */
public
static
final
List
<
String
>
supportedDatabaseProductsForProcedures
=
Arrays
.
asList
(
"Apache Derby"
,
...
...
@@ -51,6 +49,7 @@ public class CallMetaDataProviderFactory {
"PostgreSQL"
,
"Sybase"
);
/** List of supported database products for function calls */
public
static
final
List
<
String
>
supportedDatabaseProductsForFunctions
=
Arrays
.
asList
(
"MySQL"
,
...
...
@@ -59,6 +58,9 @@ public class CallMetaDataProviderFactory {
"PostgreSQL"
);
private
static
final
Log
logger
=
LogFactory
.
getLog
(
CallMetaDataProviderFactory
.
class
);
/**
* Create a CallMetaDataProvider based on the database metadata
* @param dataSource used to retrieve metadata
...
...
@@ -124,17 +126,16 @@ public class CallMetaDataProviderFactory {
}
provider
.
initializeWithMetaData
(
databaseMetaData
);
if
(
accessProcedureColumnMetaData
)
{
provider
.
initializeWithProcedureColumnMetaData
(
databaseMetaData
,
context
.
getCatalogName
(),
context
.
getSchemaName
(),
context
.
getProcedureName
());
provider
.
initializeWithProcedureColumnMetaData
(
databaseMetaData
,
context
.
getCatalogName
(),
context
.
getSchemaName
(),
context
.
getProcedureName
());
}
return
provider
;
}
});
}
catch
(
MetaDataAccessException
ex
)
{
throw
new
DataAccessResourceFailureException
(
"Error retr
ei
ving database metadata"
,
ex
);
throw
new
DataAccessResourceFailureException
(
"Error retr
ie
ving database metadata"
,
ex
);
}
}
}
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/GenericTableMetaDataProvider.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -70,7 +70,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
Arrays
.
asList
(
"Apache Derby"
,
"HSQL Database Engine"
);
/** Collection of TableParameterMetaData objects */
private
List
<
TableParameterMetaData
>
insert
ParameterMetaData
=
new
ArrayList
<
TableParameterMetaData
>();
private
List
<
TableParameterMetaData
>
table
ParameterMetaData
=
new
ArrayList
<
TableParameterMetaData
>();
/** NativeJdbcExtractor that can be used to retrieve the native connection */
private
NativeJdbcExtractor
nativeJdbcExtractor
;
...
...
@@ -109,7 +109,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
@Override
public
List
<
TableParameterMetaData
>
getTableParameterMetaData
()
{
return
this
.
insert
ParameterMetaData
;
return
this
.
table
ParameterMetaData
;
}
@Override
...
...
@@ -376,17 +376,14 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
}
try
{
tableColumns
=
databaseMetaData
.
getColumns
(
metaDataCatalogName
,
metaDataSchemaName
,
metaDataTableName
,
null
);
metaDataCatalogName
,
metaDataSchemaName
,
metaDataTableName
,
null
);
while
(
tableColumns
.
next
())
{
String
columnName
=
tableColumns
.
getString
(
"COLUMN_NAME"
);
int
dataType
=
tableColumns
.
getInt
(
"DATA_TYPE"
);
if
(
dataType
==
Types
.
DECIMAL
)
{
String
typeName
=
tableColumns
.
getString
(
"TYPE_NAME"
);
int
decimalDigits
=
tableColumns
.
getInt
(
"DECIMAL_DIGITS"
);
//
o
verride a DECIMAL data type for no-decimal numerics
//
O
verride a DECIMAL data type for no-decimal numerics
// (this is for better Oracle support where there have been issues
// using DECIMAL for certain inserts (see SPR-6912))
if
(
"NUMBER"
.
equals
(
typeName
)
&&
decimalDigits
==
0
)
{
...
...
@@ -400,18 +397,11 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
}
}
boolean
nullable
=
tableColumns
.
getBoolean
(
"NULLABLE"
);
TableParameterMetaData
meta
=
new
TableParameterMetaData
(
columnName
,
dataType
,
nullable
);
this
.
insertParameterMetaData
.
add
(
meta
);
TableParameterMetaData
meta
=
new
TableParameterMetaData
(
columnName
,
dataType
,
nullable
);
this
.
tableParameterMetaData
.
add
(
meta
);
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"Retrieved metadata: "
+
meta
.
getParameterName
()
+
" "
+
meta
.
getSqlType
()
+
" "
+
meta
.
isNullable
()
);
logger
.
debug
(
"Retrieved metadata: "
+
meta
.
getParameterName
()
+
" "
+
meta
.
getSqlType
()
+
" "
+
meta
.
isNullable
());
}
}
}
...
...
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -202,7 +202,8 @@ public class TableMetaDataContext {
* @param generatedKeyNames name of generated keys
*/
public
void
processMetaData
(
DataSource
dataSource
,
List
<
String
>
declaredColumns
,
String
[]
generatedKeyNames
)
{
this
.
metaDataProvider
=
TableMetaDataProviderFactory
.
createMetaDataProvider
(
dataSource
,
this
,
this
.
nativeJdbcExtractor
);
this
.
metaDataProvider
=
TableMetaDataProviderFactory
.
createMetaDataProvider
(
dataSource
,
this
,
this
.
nativeJdbcExtractor
);
this
.
tableColumns
=
reconcileColumnsToUse
(
declaredColumns
,
generatedKeyNames
);
}
...
...
@@ -299,14 +300,14 @@ public class TableMetaDataContext {
}
StringBuilder
insertStatement
=
new
StringBuilder
();
insertStatement
.
append
(
"INSERT INTO "
);
if
(
this
.
getSchemaName
()
!=
null
)
{
insertStatement
.
append
(
this
.
getSchemaName
());
if
(
getSchemaName
()
!=
null
)
{
insertStatement
.
append
(
getSchemaName
());
insertStatement
.
append
(
"."
);
}
insertStatement
.
append
(
this
.
getTableName
());
insertStatement
.
append
(
getTableName
());
insertStatement
.
append
(
" ("
);
int
columnCount
=
0
;
for
(
String
columnName
:
this
.
getTableColumns
())
{
for
(
String
columnName
:
getTableColumns
())
{
if
(!
keys
.
contains
(
columnName
.
toUpperCase
()))
{
columnCount
++;
if
(
columnCount
>
1
)
{
...
...
@@ -319,11 +320,11 @@ public class TableMetaDataContext {
if
(
columnCount
<
1
)
{
if
(
this
.
generatedKeyColumnsUsed
)
{
logger
.
info
(
"Unable to locate non-key columns for table '"
+
this
.
getTableName
()
+
"' so an empty insert statement is generated"
);
getTableName
()
+
"' so an empty insert statement is generated"
);
}
else
{
throw
new
InvalidDataAccessApiUsageException
(
"Unable to locate columns for table '"
+
this
.
getTableName
()
+
"' so an insert statement can't be generated"
);
getTableName
()
+
"' so an insert statement can't be generated"
);
}
}
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
...
...
@@ -341,7 +342,7 @@ public class TableMetaDataContext {
* @return the array of types to be used
*/
public
int
[]
createInsertTypes
()
{
int
[]
types
=
new
int
[
this
.
getTableColumns
().
size
()];
int
[]
types
=
new
int
[
getTableColumns
().
size
()];
List
<
TableParameterMetaData
>
parameters
=
this
.
metaDataProvider
.
getTableParameterMetaData
();
Map
<
String
,
TableParameterMetaData
>
parameterMap
=
new
LinkedHashMap
<
String
,
TableParameterMetaData
>(
parameters
.
size
());
...
...
@@ -349,7 +350,7 @@ public class TableMetaDataContext {
parameterMap
.
put
(
tpmd
.
getParameterName
().
toUpperCase
(),
tpmd
);
}
int
typeIndx
=
0
;
for
(
String
column
:
this
.
getTableColumns
())
{
for
(
String
column
:
getTableColumns
())
{
if
(
column
==
null
)
{
types
[
typeIndx
]
=
SqlTypeValue
.
TYPE_UNKNOWN
;
}
...
...
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataProviderFactory.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
5
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -30,7 +30,8 @@ import org.springframework.jdbc.support.MetaDataAccessException;
import
org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor
;
/**
* Factory used to create a {@link TableMetaDataProvider} implementation based on the type of databse being used.
* Factory used to create a {@link TableMetaDataProvider} implementation
* based on the type of databse being used.
*
* @author Thomas Risberg
* @since 2.5
...
...
spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -162,7 +162,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
}
}
private
void
updateStompHeadersFromSimpMessageHeaders
()
{
void
updateStompHeadersFromSimpMessageHeaders
()
{
if
(
getDestination
()
!=
null
)
{
setNativeHeader
(
STOMP_DESTINATION_HEADER
,
getDestination
());
}
...
...
@@ -218,19 +218,28 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return
(
StompCommand
)
getHeader
(
COMMAND_HEADER
);
}
public
Set
<
String
>
getAcceptVersion
()
{
String
rawValue
=
getFirstNativeHeader
(
STOMP_ACCEPT_VERSION_HEADER
);
return
(
rawValue
!=
null
?
StringUtils
.
commaDelimitedListToSet
(
rawValue
)
:
Collections
.<
String
>
emptySet
());
}
public
boolean
isHeartbeat
()
{
return
(
SimpMessageType
.
HEARTBEAT
==
getMessageType
());
}
public
long
[]
getHeartbeat
()
{
String
rawValue
=
getFirstNativeHeader
(
STOMP_HEARTBEAT_HEADER
);
if
(!
StringUtils
.
hasText
(
rawValue
))
{
return
Arrays
.
copyOf
(
DEFAULT_HEARTBEAT
,
2
);
}
String
[]
rawValues
=
StringUtils
.
commaDelimitedListToStringArray
(
rawValue
);
return
new
long
[]
{
Long
.
valueOf
(
rawValues
[
0
]),
Long
.
valueOf
(
rawValues
[
1
])};
}
public
void
setAcceptVersion
(
String
acceptVersion
)
{
setNativeHeader
(
STOMP_ACCEPT_VERSION_HEADER
,
acceptVersion
);
}
public
Set
<
String
>
getAcceptVersion
()
{
String
rawValue
=
getFirstNativeHeader
(
STOMP_ACCEPT_VERSION_HEADER
);
return
(
rawValue
!=
null
?
StringUtils
.
commaDelimitedListToSet
(
rawValue
)
:
Collections
.<
String
>
emptySet
());
}
public
void
setHost
(
String
host
)
{
setNativeHeader
(
STOMP_HOST_HEADER
,
host
);
}
...
...
@@ -245,15 +254,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
setNativeHeader
(
STOMP_DESTINATION_HEADER
,
destination
);
}
public
long
[]
getHeartbeat
()
{
String
rawValue
=
getFirstNativeHeader
(
STOMP_HEARTBEAT_HEADER
);
if
(!
StringUtils
.
hasText
(
rawValue
))
{
return
Arrays
.
copyOf
(
DEFAULT_HEARTBEAT
,
2
);
}
String
[]
rawValues
=
StringUtils
.
commaDelimitedListToStringArray
(
rawValue
);
return
new
long
[]
{
Long
.
valueOf
(
rawValues
[
0
]),
Long
.
valueOf
(
rawValues
[
1
])};
}
@Override
public
void
setContentType
(
MimeType
contentType
)
{
super
.
setContentType
(
contentType
);
setNativeHeader
(
STOMP_CONTENT_TYPE_HEADER
,
contentType
.
toString
());
...
...
spring-web/src/main/java/org/springframework/http/StreamingHttpOutputMessage.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -33,12 +33,13 @@ public interface StreamingHttpOutputMessage extends HttpOutputMessage {
*/
void
setBody
(
Body
body
);
/**
* Defines the contract for bodies that can be written directly to a
*
{@link OutputStream}. It is useful with HTTP client libraries that provide indirect
*
access to an
{@link OutputStream} via a callback mechanism.
* Defines the contract for bodies that can be written directly to a
n {@link OutputStream}.
*
It is useful with HTTP client libraries that provide indirect access to an
* {@link OutputStream} via a callback mechanism.
*/
public
interface
Body
{
interface
Body
{
/**
* Writes this body to the given {@link OutputStream}.
...
...
@@ -46,7 +47,6 @@ public interface StreamingHttpOutputMessage extends HttpOutputMessage {
* @throws IOException in case of errors
*/
void
writeTo
(
OutputStream
outputStream
)
throws
IOException
;
}
}
spring-web/src/main/java/org/springframework/web/multipart/MaxUploadSizeExceededException.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -52,7 +52,7 @@ public class MaxUploadSizeExceededException extends MultipartException {
* Return the maximum upload size allowed.
*/
public
long
getMaxUploadSize
()
{
return
maxUploadSize
;
return
this
.
maxUploadSize
;
}
}
spring-web/src/test/java/org/springframework/web/bind/support/WebRequestDataBinderTests.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -147,6 +147,28 @@ public class WebRequestDataBinderTests {
assertFalse
(
target
.
isPostProcessed
());
}
@Test
public
void
testFieldDefaultWithNestedProperty
()
throws
Exception
{
TestBean
target
=
new
TestBean
();
target
.
setSpouse
(
new
TestBean
());
WebRequestDataBinder
binder
=
new
WebRequestDataBinder
(
target
);
MockHttpServletRequest
request
=
new
MockHttpServletRequest
();
request
.
addParameter
(
"!spouse.postProcessed"
,
"on"
);
request
.
addParameter
(
"_spouse.postProcessed"
,
"visible"
);
request
.
addParameter
(
"spouse.postProcessed"
,
"on"
);
binder
.
bind
(
new
ServletWebRequest
(
request
));
assertTrue
(((
TestBean
)
target
.
getSpouse
()).
isPostProcessed
());
request
.
removeParameter
(
"spouse.postProcessed"
);
binder
.
bind
(
new
ServletWebRequest
(
request
));
assertTrue
(((
TestBean
)
target
.
getSpouse
()).
isPostProcessed
());
request
.
removeParameter
(
"!spouse.postProcessed"
);
binder
.
bind
(
new
ServletWebRequest
(
request
));
assertFalse
(((
TestBean
)
target
.
getSpouse
()).
isPostProcessed
());
}
@Test
public
void
testFieldDefaultNonBoolean
()
throws
Exception
{
TestBean
target
=
new
TestBean
();
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/NoHandlerFoundException.java
浏览文件 @
ce4e795f
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
5
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.
...
...
@@ -13,20 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.servlet
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.http.HttpHeaders
;
/**
* Exception to be thrown if DispatcherServlet is unable to determine a corresponding
* handler for an incoming HTTP request. The DispatcherServlet throws this exception
only
*
if its throwExceptionIfNoHandlerFound
property is set to "true".
* handler for an incoming HTTP request. The DispatcherServlet throws this exception
*
only if its "throwExceptionIfNoHandlerFound"
property is set to "true".
*
* @author Brian Clozel
* @since 4.0
* @see org.springframework.web.servlet.DispatcherServlet
* @see DispatcherServlet#setThrowExceptionIfNoHandlerFound(boolean)
* @see DispatcherServlet#noHandlerFound(HttpServletRequest, HttpServletResponse)
*/
@SuppressWarnings
(
"serial"
)
public
class
NoHandlerFoundException
extends
ServletException
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录