_004_Eclipse中引入spring的约束

来自https://blog.csdn.net/SIMBA1949/article/details/79515366,感谢作者的无私分享。

Eclipse中引入spring的约束

约束文件

spring源码、约束文件和文档说明下载地址:http://repo.spring.io/release/org/springframework/spring/

这里写图片描述

点击spring-framework-5.0.4.RELEASE-schema.zip ,下载schema约束文件

这里写图片描述

解压spring-framework-5.0.4.RELEASE-schema.zip 文件

这里写图片描述

KEY值

#key的类型为
Schema location
#beans的key值
http://www.springframework.org/schema/beans/spring-beans.xsd
#util的key值
http://www.springframework.org/schema/util/spring-util.xsd
#jee的key值
http://www.springframework.org/schema/jee/spring-jee.xsd
#lang的key值
http://www.springframework.org/schema/lang/spring-lang.xsd
#jms的key值
http://www.springframework.org/schema/jms/spring-jms.xsd
#aop的key值
http://www.springframework.org/schema/aop/spring-aop.xsd
#tx的key值
http://www.springframework.org/schema/tx/spring-tx.xsd
#context的key值
http://www.springframework.org/schema/context/spring-context.xsd
#jdbc的key值
http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
#cache的key值
http://www.springframework.org/schema/cache/spring-cache.xsd
#mvc的key值
http://www.springframework.org/schema/mvc/spring-mvc.xsd
#oxm的key值
http://www.springframework.org/schema/oxm/spring-oxm.xsd
#task的key值
http://www.springframework.org/schema/task/spring-task.xsd
#tool的key值
http://www.springframework.org/schema/tool/spring-tool.xsd
#websocket的key值
http://www.springframework.org/schema/websocket/spring-websocket.xsd

在eclipse中配置

点击window->preferences,弹出Preferences窗口-

这里写图片描述

搜索xml->点击XML Catalog->点击add按钮->选择约束文件->选择key的类型和输入key值->点击ok->点击appliy and close

这里写图片描述

问题

如果没有提示,首先检查文件是否所有约束是否配置全,如果没有请配置全。如果有,重启eclipse即可

测试MVC,配置其他和配置MVC一样步骤

这里写图片描述

Application.xml最全格式

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:lang="http://www.springframework.org/schema/lang"
    xmlns:jms="http://www.springframework.org/schema/jms"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:cache="http://www.springframework.org/schema/cache"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:oxm="http://www.springframework.org/schema/oxm"
    xmlns:task="http://www.springframework.org/schema/task"
    xmlns:tool="http://www.springframework.org/schema/tool"
    xmlns:websocket="http://www.springframework.org/schema/websocket"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
        http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
        http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
        http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
        http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool.xsd
        http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket/spring-websocket.xsd">

</beans>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值