Sping的Xml配置命名空间
2015-11-24 12:29
381 查看
p:命名空间:<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
</beans>
util:命名空间:<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
</beans>
使用注解配置(context命名空间):<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- 自动扫描指定包及其子包下的所有Bean类 ,指定resource-pattern可以指定扫描基类下的子包,默认是“**/*.class”的形势,还有很多通过子元素增加过滤条件具体参照《Spring3.0就是这么简单》55页-->
<context:component-scan
base-package="包名"/>
</beans>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
</beans>
util:命名空间:<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
</beans>
使用注解配置(context命名空间):<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- 自动扫描指定包及其子包下的所有Bean类 ,指定resource-pattern可以指定扫描基类下的子包,默认是“**/*.class”的形势,还有很多通过子元素增加过滤条件具体参照《Spring3.0就是这么简单》55页-->
<context:component-scan
base-package="包名"/>
</beans>
相关文章推荐
- 缺陷漏测分析:测试过程改进
- gdb 显示数组全部元素
- Linux Tips: How to Quickly Bind a Range of IPs on RedHat Based Systems
- centos源码安装nginx
- 13、Java反射
- LLC子层为什么不在数据包中体现?LLC子层具体作用是什么?Ethernet_II如何表示帧结束?
- 关于WM_NOTIFY的使用方法
- timer和Thread.sleep()区别
- 我的博客
- android的ProcessException
- Android textView 添加超链接(两种实现方式)
- 麒麟系统为何饱受非议?
- 判断字符串为空
- jQuery实现带分组数据的Table表头排序实例分析
- trunc(sysdate)的含义
- shader - 语法
- QDataStream 用法
- gdb断点控制
- Android SIP话机
- linux查看CPU高速缓存(cache)信息