Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
7c6c1c3a
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,发现更多精彩内容 >>
提交
7c6c1c3a
编写于
12月 11, 2009
作者:
C
Christian Dupuis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some minor adjustments to the mvc namespace to make it work in the tools
上级
14b69148
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
7 deletion
+28
-7
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java
.../servlet/config/AnnotationDrivenBeanDefinitionParser.java
+12
-5
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/config/InterceptorsBeanDefinitionParser.java
.../web/servlet/config/InterceptorsBeanDefinitionParser.java
+10
-1
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/config/ViewControllerBeanDefinitionParser.java
...eb/servlet/config/ViewControllerBeanDefinitionParser.java
+6
-1
未找到文件。
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java
浏览文件 @
7c6c1c3a
...
...
@@ -16,8 +16,6 @@
package
org.springframework.web.servlet.config
;
import
org.w3c.dom.Element
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.RuntimeBeanReference
;
import
org.springframework.beans.factory.parsing.BeanComponentDefinition
;
...
...
@@ -40,6 +38,7 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import
org.springframework.web.bind.support.ConfigurableWebBindingInitializer
;
import
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter
;
import
org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping
;
import
org.w3c.dom.Element
;
/**
* {@link BeanDefinitionParser} that parses the {@code annotation-driven} element to configure a Spring MVC web
...
...
@@ -85,24 +84,28 @@ public class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParse
public
BeanDefinition
parse
(
Element
element
,
ParserContext
parserContext
)
{
Object
source
=
parserContext
.
extractSource
(
element
);
CompositeComponentDefinition
compDefinition
=
new
CompositeComponentDefinition
(
element
.
getTagName
(),
source
);
parserContext
.
pushContainingComponent
(
compDefinition
);
RootBeanDefinition
annMappingDef
=
new
RootBeanDefinition
(
DefaultAnnotationHandlerMapping
.
class
);
annMappingDef
.
setSource
(
source
);
annMappingDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
annMappingDef
.
getPropertyValues
().
add
(
"order"
,
0
);
String
annMappingName
=
parserContext
.
getReaderContext
().
registerWithGeneratedName
(
annMappingDef
);
RootBeanDefinition
bindingDef
=
new
RootBeanDefinition
(
ConfigurableWebBindingInitializer
.
class
);
bindingDef
.
setSource
(
source
);
bindingDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
bindingDef
.
getPropertyValues
().
add
(
"conversionService"
,
getConversionService
(
element
,
source
,
parserContext
));
bindingDef
.
getPropertyValues
().
add
(
"validator"
,
getValidator
(
element
,
source
,
parserContext
));
RootBeanDefinition
annAdapterDef
=
new
RootBeanDefinition
(
AnnotationMethodHandlerAdapter
.
class
);
annAdapterDef
.
setSource
(
source
);
annAdapterDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
annAdapterDef
.
getPropertyValues
().
add
(
"webBindingInitializer"
,
bindingDef
);
annAdapterDef
.
getPropertyValues
().
add
(
"messageConverters"
,
getMessageConverters
(
source
));
String
adapterName
=
parserContext
.
getReaderContext
().
registerWithGeneratedName
(
annAdapterDef
);
CompositeComponentDefinition
compDefinition
=
new
CompositeComponentDefinition
(
element
.
getTagName
(),
source
);
parserContext
.
pushContainingComponent
(
compDefinition
);
parserContext
.
registerComponent
(
new
BeanComponentDefinition
(
annMappingDef
,
annMappingName
));
parserContext
.
registerComponent
(
new
BeanComponentDefinition
(
annAdapterDef
,
adapterName
));
parserContext
.
popAndRegisterContainingComponent
();
...
...
@@ -118,7 +121,9 @@ public class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParse
else
{
RootBeanDefinition
conversionDef
=
new
RootBeanDefinition
(
FormattingConversionServiceFactoryBean
.
class
);
conversionDef
.
setSource
(
source
);
conversionDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
String
conversionName
=
parserContext
.
getReaderContext
().
registerWithGeneratedName
(
conversionDef
);
parserContext
.
registerComponent
(
new
BeanComponentDefinition
(
conversionDef
,
conversionName
));
return
new
RuntimeBeanReference
(
conversionName
);
}
}
...
...
@@ -130,7 +135,9 @@ public class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParse
else
if
(
jsr303Present
)
{
RootBeanDefinition
validatorDef
=
new
RootBeanDefinition
(
LocalValidatorFactoryBean
.
class
);
validatorDef
.
setSource
(
source
);
validatorDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
String
validatorName
=
parserContext
.
getReaderContext
().
registerWithGeneratedName
(
validatorDef
);
parserContext
.
registerComponent
(
new
BeanComponentDefinition
(
validatorDef
,
validatorName
));
return
new
RuntimeBeanReference
(
validatorName
);
}
else
{
...
...
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/config/InterceptorsBeanDefinitionParser.java
浏览文件 @
7c6c1c3a
...
...
@@ -20,6 +20,8 @@ import java.util.List;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.BeanDefinitionHolder
;
import
org.springframework.beans.factory.parsing.BeanComponentDefinition
;
import
org.springframework.beans.factory.parsing.CompositeComponentDefinition
;
import
org.springframework.beans.factory.support.RootBeanDefinition
;
import
org.springframework.beans.factory.xml.BeanDefinitionParser
;
import
org.springframework.beans.factory.xml.ParserContext
;
...
...
@@ -37,10 +39,14 @@ import org.w3c.dom.Element;
class
InterceptorsBeanDefinitionParser
implements
BeanDefinitionParser
{
public
BeanDefinition
parse
(
Element
element
,
ParserContext
parserContext
)
{
CompositeComponentDefinition
compDefinition
=
new
CompositeComponentDefinition
(
element
.
getTagName
(),
parserContext
.
extractSource
(
element
));
parserContext
.
pushContainingComponent
(
compDefinition
);
List
<
Element
>
interceptors
=
DomUtils
.
getChildElementsByTagName
(
element
,
new
String
[]
{
"bean"
,
"interceptor"
});
for
(
Element
interceptor
:
interceptors
)
{
RootBeanDefinition
mappedInterceptorDef
=
new
RootBeanDefinition
(
MappedInterceptor
.
class
);
mappedInterceptorDef
.
setSource
(
parserContext
.
extractSource
(
interceptor
));
mappedInterceptorDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
String
[]
pathPatterns
;
BeanDefinitionHolder
interceptorDef
;
if
(
"interceptor"
.
equals
(
interceptor
.
getLocalName
()))
{
...
...
@@ -59,8 +65,11 @@ class InterceptorsBeanDefinitionParser implements BeanDefinitionParser {
}
mappedInterceptorDef
.
getConstructorArgumentValues
().
addIndexedArgumentValue
(
0
,
pathPatterns
);
mappedInterceptorDef
.
getConstructorArgumentValues
().
addIndexedArgumentValue
(
1
,
interceptorDef
);
parserContext
.
getReaderContext
().
registerWithGeneratedName
(
mappedInterceptorDef
);
String
mappedInterceptorName
=
parserContext
.
getReaderContext
().
registerWithGeneratedName
(
mappedInterceptorDef
);
parserContext
.
registerComponent
(
new
BeanComponentDefinition
(
mappedInterceptorDef
,
mappedInterceptorName
));
}
parserContext
.
popAndRegisterContainingComponent
();
return
null
;
}
...
...
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/config/ViewControllerBeanDefinitionParser.java
浏览文件 @
7c6c1c3a
...
...
@@ -19,6 +19,7 @@ package org.springframework.web.servlet.config;
import
java.util.Map
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.parsing.BeanComponentDefinition
;
import
org.springframework.beans.factory.support.ManagedMap
;
import
org.springframework.beans.factory.support.RootBeanDefinition
;
import
org.springframework.beans.factory.xml.BeanDefinitionParser
;
...
...
@@ -46,14 +47,18 @@ class ViewControllerBeanDefinitionParser implements BeanDefinitionParser {
if
(
this
.
handlerAdapterBeanName
==
null
)
{
RootBeanDefinition
handlerAdapterDef
=
new
RootBeanDefinition
(
SimpleControllerHandlerAdapter
.
class
);
handlerAdapterDef
.
setSource
(
source
);
handlerAdapterDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
this
.
handlerAdapterBeanName
=
parserContext
.
getReaderContext
().
registerWithGeneratedName
(
handlerAdapterDef
);
parserContext
.
registerComponent
(
new
BeanComponentDefinition
(
handlerAdapterDef
,
handlerAdapterBeanName
));
}
RootBeanDefinition
handlerMappingDef
;
if
(
this
.
handlerMappingBeanName
==
null
)
{
handlerMappingDef
=
new
RootBeanDefinition
(
SimpleUrlHandlerMapping
.
class
);
handlerMappingDef
.
setSource
(
source
);
handlerMappingDef
.
getPropertyValues
().
add
(
"order"
,
"1"
);
this
.
handlerMappingBeanName
=
parserContext
.
getReaderContext
().
registerWithGeneratedName
(
handlerMappingDef
);
handlerMappingDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
this
.
handlerMappingBeanName
=
parserContext
.
getReaderContext
().
registerWithGeneratedName
(
handlerMappingDef
);
parserContext
.
registerComponent
(
new
BeanComponentDefinition
(
handlerMappingDef
,
handlerMappingBeanName
));
}
else
{
handlerMappingDef
=
(
RootBeanDefinition
)
parserContext
.
getReaderContext
().
getRegistry
().
getBeanDefinition
(
this
.
handlerMappingBeanName
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录