ele*_*ype 28 spring spring-mvc spring-security
在我的Spring 3.1应用程序中,我有时需要更改上下文文件中某些Spring命名空间的默认行为.为此,我创建了实现某些接口或扩展Spring使用的默认类的自定义类.
但我发现很难确切知道Spring在其命名空间后面使用的是什么类!找到它们需要哪些步骤?
例如,安全命名空间:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:sec="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
Run Code Online (Sandbox Code Playgroud)
和类似的东西:
<sec:http>
...
<sec:logout />
</sec:http>
Run Code Online (Sandbox Code Playgroud)
如何找到"<sec:logout />"命名空间使用的类?我没有通过查看http://www.springframework.org/schema/security/spring-security-3.1.xsd找到这些信息!
我应该在哪里看?
Tom*_*icz 49
每个Spring命名空间都有一个关联的NamespaceHandler实现 命名空间模式在各种spring.schemas文件中映射到Spring JAR中的模式文件(另请参见Spring DI applicationContext.xml,xsi:schemaLocation是如何使用的?).
XML模式名称空间也映射到spring.handlers文件中的处理程序类(有几个,因为每个Spring JAR可能引入不同的名称空间).为方便起见,这里列出了最常见的命名空间:
aop - AopNamespaceHandlerc - SimpleConstructorNamespaceHandlercache - CacheNamespaceHandlercontext - ContextNamespaceHandlerjdbc - JdbcNamespaceHandlerjee - JeeNamespaceHandlerjms - JmsNamespaceHandlerlang - LangNamespaceHandlermvc - MvcNamespaceHandleroxm - OxmNamespaceHandlerp - SimplePropertyNamespaceHandlertask - TaskNamespaceHandlertx - TxNamespaceHandlerutil - UtilNamespaceHandlersecurity - SecurityNamespaceHandleroauth - OAuthSecurityNamespaceHandlerint - IntegrationNamespaceHandleramqp - AmqpNamespaceHandlerevent - EventNamespaceHandlerfeed - FeedNamespaceHandlerfile - FileNamespaceHandlerftp - FtpNamespaceHandlergemfire - GemfireIntegrationNamespaceHandlergroovy - GroovyNamespaceHandlerhttp - HttpNamespaceHandlerip - IpNamespaceHandlerjdbc - JdbcNamespaceHandlerjms - JmsNamespaceHandlerjmx - JmxNamespaceHandlermail - MailNamespaceHandlerredis - RedisNamespaceHandlerrmi - RmiNamespaceHandlerscript - ScriptNamespaceHandlersecurity - IntegrationSecurityNamespaceHandlersftp - SftpNamespaceHandlerstream - StreamNamespaceHandlertwitter - TwitterNamespaceHandlerws - WsNamespaceHandlerxml - IntegrationXmlNamespaceHandlerxmpp - XmppNamespaceHandler如果浏览到每个类的源代码,您将很快发现BeanDefinitionParser负责解析实际XML定义的各种实现.
| 归档时间: |
|
| 查看次数: |
21885 次 |
| 最近记录: |