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的配置文件 没联网也有提示了

  • 相关阅读:
    嵌入式Linux基础知识
    面向对象程序设计与原则
    设计模式之工厂模式
    设计模式之单例模式
    基于Doxygen的C/C++注释原则
    设计模式概论
    重启博客
    java 单例模式的几种写法
    CountDownLatch、CyclicBarrier
    java ConcurrentHashMap和CopyOnWriteArrayList解决并发问题
  • 原文地址:https://www.cnblogs.com/jokerq/p/10048743.html
Copyright © 2011-2022 走看看