Spring XML namespaces : How do I find what are the implementing classes behind them?

后端 未结 4 1300
暖寄归人
暖寄归人 2020-12-22 18:12

In my Spring 3.1 application, I sometime need to change the default behavior of some of the Spring namespaces in my context files. To do that, I create custom classes that i

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-22 19:03

    Every Spring namespace has an associated NamespaceHandler implementation. The namespace schemas are mapped to schema files inside Spring JARs in various spring.schemas files (see also Spring DI applicationContext.xml how exactly is xsi:schemaLocation used?).

    The XML schema namespaces are also mapped to handler classes in spring.handlers files (several as each Spring JAR might introduce different namespaces). For your convenience here is a list of most common namespaces:

    Spring core

    • aop - AopNamespaceHandler
    • c - SimpleConstructorNamespaceHandler
    • cache - CacheNamespaceHandler
    • context - ContextNamespaceHandler
    • jdbc - JdbcNamespaceHandler
    • jee - JeeNamespaceHandler
    • jms - JmsNamespaceHandler
    • lang - LangNamespaceHandler
    • mvc - MvcNamespaceHandler
    • oxm - OxmNamespaceHandler
    • p - SimplePropertyNamespaceHandler
    • task - TaskNamespaceHandler
    • tx - TxNamespaceHandler
    • util - UtilNamespaceHandler

    Spring Security

    • security - SecurityNamespaceHandler
    • oauth - OAuthSecurityNamespaceHandler

    Spring integration

    • int - IntegrationNamespaceHandler
    • amqp - AmqpNamespaceHandler
    • event - EventNamespaceHandler
    • feed - FeedNamespaceHandler
    • file - FileNamespaceHandler
    • ftp - FtpNamespaceHandler
    • gemfire - GemfireIntegrationNamespaceHandler
    • groovy - GroovyNamespaceHandler
    • http - HttpNamespaceHandler
    • ip - IpNamespaceHandler
    • jdbc - JdbcNamespaceHandler
    • jms - JmsNamespaceHandler
    • jmx - JmxNamespaceHandler
    • mail - MailNamespaceHandler
    • redis - RedisNamespaceHandler
    • rmi - RmiNamespaceHandler
    • script - ScriptNamespaceHandler
    • security - IntegrationSecurityNamespaceHandler
    • sftp - SftpNamespaceHandler
    • stream - StreamNamespaceHandler
    • twitter - TwitterNamespaceHandler
    • ws - WsNamespaceHandler
    • xml - IntegrationXmlNamespaceHandler
    • xmpp - XmppNamespaceHandler

    If you browse to the source of each of these classes you will quickly discover various BeanDefinitionParser implementations responsible for parsing actual XML definitions.

提交回复
热议问题