zoukankan      html  css  js  c++  java
  • java 约束配置文件和本地约束

    一、寻找spring配置文件约束头(也可直接复制已有的)

    1.在本地文件夹解压spring核心包(dist)

      例:核心包的约束位置(D:JavaSourcesspring-framework-4.2.4.RELEASEdocsspring-framework-referencehtmlxsd-configuration.html)

        打开此网页,在网页最下面为spring约束头

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="foo" class="x.y.Foo"> <meta key="cacheName" value="foo"/> <property name="name" value="Rick"/> </bean> </beans>

    二、配置本地约束 可以在xml中有提示 否则约束头只有在联网时写配置文件才有有智能提示

    一、dtd形式本地约束

     例:struts本地约束

     1.找到 xml约束文件配置位置: windows --» preferences --» XML Catalog

    2.设置自己需要配置的 URI ,添加本地的 DTD 约束文件

     3.重新打开配置文件即可

    二、xsd形式本地约束

    例:spring本地约束

    spring配置本地约束 可以在xml中有提示 否则约束头只有在联网有提示

    1.在本地文件夹解压spring约束包(schema)或核心包(dist)

      例:核心包的约束位置(D:JavaSourcesspring-framework-4.2.4.RELEASEschemaeans),用下面的最新的约束文件

    2.先复制spring配置文件约束头的配置信息以备使用(http://www.springframework.org/schema/beans/spring-beans.xsd)

    3.在eclipse中  window--》preferences--》搜索 xml catalog

    4.点击ADD --》 file system   --》选择本地的约束文件位置

    5、在 key type 中选择 Schema location

    6.将复制的约束信息粘到key中

    7.  ok保存重新打开配置文件即可

      之后再编写spring的配置文件 没联网也有提示了

  • 相关阅读:
    《JavaScript高级程序设计》第14、17、20章
    《JavaScript高级程序设计》第12-13章
    《JavaScript高级程序设计》第10-11章
    《JavaScript高级程序设计》第8-9章
    《JavaScript高级程序设计》第6-7章
    《JavaScript高级程序设计》第4-5章
    《JavaScript高级程序设计》第1-3章
    《CSS3秘籍》第12-17章
    《CSS3秘籍》第8-11章
    jsoncpp操作 json
  • 原文地址:https://www.cnblogs.com/jokerq/p/10048743.html
Copyright © 2011-2022 走看看