eclipse导入Spring配置文件约束

eclipse导入Spring配置文件约束

  1. 点击window下的Perferenceseclipse导入Spring配置文件约束

  2. (1)搜索xml
    (2)找到XML Catalog
    (3)点击Add,添加
    eclipse导入Spring配置文件约束

  3. 点 Add 选File System 找到spring下的的解压包下的schema文件夹,选beans,然后选择spring对应的版本的xsd文件
    eclipse导入Spring配置文件约束

  4. (1) 选择指定xsd文件,
    (2) 选择Key type类型
    (3) Key值,再Key的路径后面添加"/spring-beans-4.2.xsd"点okeclipse导入Spring配置文件约束
    eclipse导入Spring配置文件约束

  5. 创建applicationContext.xml 写根元素 <beans></beans>
    eclipse导入Spring配置文件约束

  6. 切换到Design
    eclipse导入Spring配置文件约束

  7. 右键点击beans,找到Edit Namespaces
    eclipse导入Spring配置文件约束

  8. Add导入XSI, OK,再点Add,选择 Specify New Namespace
    eclipse导入Spring配置文件约束

  9. Select XML Catalog entry 大概在中间位置插入我们的xsd文件
    eclipse导入Spring配置文件约束
    eclipse导入Spring配置文件约束

  10. 复制xsd文件路径(不含文件名) 粘贴到 Namespace Name
    eclipse导入Spring配置文件约束
    切换到源码视图 可以看到已经成功导入
    eclipse导入Spring配置文件约束
    这样Spring约束配置就完成