Spring3自定义环境配置 <beans profile="">
来源:互联网 发布:精功科技收购盘古数据 编辑:程序博客网 时间:2024/05/16 05:28
摘自springside3
Spring 3.1的功能,以后就不用为了区分Test, Dev, Production环境,搞几个只有细微区别的application.xml, application-test.xml及引用它们的web.xml了。
首先,将applicationContext.xml中的namespace从3.0升级到3.1.xsd, 然后就可以在文件末尾加入不同环境的定义,比如不同的dataSource
首先,将applicationContext.xml中的namespace从3.0升级到3.1.xsd, 然后就可以在文件末尾加入不同环境的定义,比如不同的dataSource
2.在web.xml里,你需要定义使用的profile,最聪明的做法是定义成context-param,注意这里定义的是default值,在非生产环境,可以用系统变量"spring.profiles.active"进行覆盖。
3.在其他地方进行覆盖
3.1 在development和functional test启动Jetty前设置系统变量
3.2 在用到ApplicationContext的单元测试用例中,用 @ActiveProfiles定义
在springside里有演示了production,development,test,functional三个环境, 大家可以根据实际情况组合自己的环境管理。另外可以与Spring的properties文件加载时可顺位覆盖的特性(放一些不在版本管理中的xx.local.properties文件),更好的支持本地开发环境,Jenkins上的functional test等其他环境。
详情:https://github.com/springside/springside4/wiki/Spring
http://huiseyiyu.iteye.com/blog/1202401
详细配置与使用:http://www.cnblogs.com/chanedi/archive/2012/01/12/2320837.html
当然,如果部署在linux中,也可以通过-Dspring.profiles.active="development"来定义
0 0
- Spring3自定义环境配置 <beans profile="">
- Spring3自定义环境配置 <beans profile="">
- Spring3自定义环境配置 <beans profile="">
- Spring3自定义环境配置 <beans profile="">
- Spring3自定义环境配置 <beans profile="">
- Spring3自定义环境配置 <beans profile="">
- Spring3自定义环境配置 <beans profile="">
- Spring3.1+自定义环境配置 <beans profile="">
- spring3.1 profile 配置不同的环境
- spring3.1 profile 配置不同的环境
- spring3.1 profile 配置不同的环境
- spring3.1 profile 配置不同的环境
- Spring3.1中使用profile配置开发测试线上环境
- Spring3.1 profile 配置不同的数据库环境
- 使用Spring3.1后的的Profile配置使不同环境加载不同配置文件
- Profile-多环境配置
- profile分环境配置流程
- maven profile多环境配置
- 海思3518c普通串口更换485通讯(启用rtsn管脚)-内核代码修改
- POJ 2393 Yogurt Factory(贪心 ?? dp)
- TCP/IP 扫盲教程
- 最近公共祖先
- 牛客网-Java-字符统计
- Spring3自定义环境配置 <beans profile="">
- js实现div的显示与隐藏
- 堆排序JAVA版实现
- java冒泡排序演示
- 不使用临时表,仅使用select实现查询出多行常数
- 实现将YUV 格式数据转换成 RGBA 格式数据的Native层代码
- bzoj1083(MST)
- 基于HDFS的SparkStreaming案例实战和内幕源码解密
- 234. Palindrome Linked List