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

  • 相关阅读:
    Java Comparator和Comparabler的区别
    正则表达式全部符号解释
    Java使用reids,以及redis与shiro集成
    jQuery的select相关操作
    javascrit原生实现jquery的append()函数
    spring拦截器 实现应用之性能监控
    Gitlab完美安装【CentOS6.5安装gitlab-6.9.2】
    关于datepicker只显示年、月、日的设置
    spring aop 环绕通知around和其他通知的区别
    springMVC和spring各自扫描自己的注解不要相互混淆
  • 原文地址:https://www.cnblogs.com/jokerq/p/10048743.html
Copyright © 2011-2022 走看看