spring配置文件头部xmlns配置解说

刚开始学习spring或许都对其配置文件头部的各种配置表示困惑,先贴出一个比较常见的头部文件

 

<beans xmlns="http://www.springframework.org/schema/beans"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns:aop="http://www.springframework.org/schema/aop"
		xmlns:tx="http://www.springframework.org/schema/tx"
		xmlns:context="http://www.springframework.org/schema/context"
		xsi:schemaLocation="
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
			http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
			http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
		>


对于使用spring的朋友,对这些应该再熟悉不过了,使用spring1年多了,今天偶尔间总算知道这些配置文件是干什么的了,spring2.0以前的版本是基于dtd的配置方式,之后的版本开始支持schema的配置,dtd的配置当bean属性太多或者复杂的时候,就会显得臃肿,这时就可以采用schema来精简一下了。

 

要使用schema就要引入相关的schema了,而上述的头部配置,观察下相应大家应该明白都引入了什么了,分别是aop tx context的引入,没错,头部这么一大串其实就是引入要使用的schemapeizhi 文件。

 

至于怎么精简,不是本博客的目的,在这里只是给对配置文件的头部迷惑的朋友分享下,它不是什么神秘的东西,仅仅是引用使用的模块。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值