Spring 配置文件头 & Spring jar 包

这篇博文介绍一下Spring中的固定配置

<?xml version="1.0" encoding="UTF-8"?>

头声明是XML文件,版本,字符类型

为了方便理解在这里就不一下子把全部的配置写出来了  想到哪个模块就写哪几句然后单独的介绍


1: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:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
	http://www.springframework.org/schema/context 
	http://www.springframework.org/schema/context/spring-context-3.2.xsd
	
	http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
	
	http://www.springframework.org/schema/jdbc 
	http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
	
	http://www.springframework.org/schema/tx 
	http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
	
	http://www.springframework.org/schema/aop 
	http://www.springframework.org/schema/aop/spring-aop-3.2.xsd">


</beans>

xmlns : 用来检验 XML 是否符合格式
xsi、 aop、 tx、 jdbc、 context : 是命名空间指向后边的地址;    列如<aop:config></aop:config>中的aop
xsi:schemaLocation 提供上边命名空间的 XML 架构定义

1)引入Bean的命名空间

xmlns="http://www.springframework.org/schema/beans"

2)表示遵守w3的xml schema规范,在xml解析器解析时,就明白按照什么规范解析了

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

3)引入AOP的命名空间

xmlns:aop="http://www.springframework.org/schema/aop"

4)引入声明式容器事务管理命名空间

xmlns:tx="http://www.springframework.org/schema/tx"

5)引入数据库命名空间

xmlns:jdbc="http://www.springframework.org/schema/jdbc"

6)初始化上下文的命名空间

xmlns:context="http://www.springframework.org/schema/context"

下边 xsi:schemaLocation 中的网址用来指定配置的版本以及精简Bean配置

其实这些头配置并没有什么神秘的,做一个简单粗暴的类 头配置就好像是你在 Java 中用到 Map 类需要导入 util 包一个道理;各位朋友不需要再这上面纠结;


2:Spring JAR 包

引入JAR包就是引用 Spring 的模块,Spring 的包其实也没有多少-但是要想使用Spring的功能就必须用到一些依赖的包比如日志功能模块什么的

一个技术上的前辈写的一个文章 : http://blog.csdn.net/weisong530624687/article/details/50888094  作者:我想换个霸气点的昵称

这篇文章总结的很全也很详细,各位可以参考一下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值