spring.profiles.active 针对多种启动环境的spring配置
2016-08-11 16:02
453 查看
我们的工程一般在会跑在正式环境、测试环境上,当打包或者运行的时候,切换数据库信息可能会是很麻烦的问题。
配置方式:
1、在spring配置文件中配置两种环境信息
<beans profile="dev">
<context:property-placeholder location="classpath:jdbc-dev.properties"/>
</beans>
<beans profile="prd">
<context:property-placeholder location="classpath:jdbc-prd.properties"/>
</beans>
2、在web.xml中配置使用哪种环境信息,tomcat启动的时候自动去加载对应的环境信息
<context-param>
<param-name>spring.profiles.active</param-name>
<param-value>dev</param-value>
</context-param>
配置方式:
1、在spring配置文件中配置两种环境信息
<beans profile="dev">
<context:property-placeholder location="classpath:jdbc-dev.properties"/>
</beans>
<beans profile="prd">
<context:property-placeholder location="classpath:jdbc-prd.properties"/>
</beans>
2、在web.xml中配置使用哪种环境信息,tomcat启动的时候自动去加载对应的环境信息
<context-param>
<param-name>spring.profiles.active</param-name>
<param-value>dev</param-value>
</context-param>
相关文章推荐
- spring.profiles.active 针对多种启动环境的spring配置
- spring.profiles.active 针对多种启动环境的spring配置
- spring.profiles.active配置多种spring启动环境
- SpringBoot application.yml logback.xml,多环境配置,支持 java -jar --spring.profiles.active(转)
- SpringBoot application.yml logback.xml,多环境配置,支持 java -jar --spring.profiles.active
- springboot 使用spring.profiles.active 区分不同环境下配置文件
- springboot 使用spring.profiles.active来分区配置
- spring boot 入门 使用spring.profiles.active来分区配置-java编程
- Spring.profiles多环境配置最佳实践
- 使用 spring.profiles.active 及 @profile 注解 动态化配置内部及外部配置
- 指定某个生产环境下的某些文件来运行springboot jar包(--spring.profiles.active=dev)
- Spring.profiles多环境配置
- java编程中spring boot 使用spring.profiles.active来分区配置
- Springboot使用maven的profiles实现多环境配置文件切换
- Spring.profiles多环境配置最佳实践
- tomcat启动为什么 写入这句话 -Dspring.profiles.active=dev
- Spring.profiles多环境配置原理
- spring.profiles.active来分区配置
- Spring Boot教程 - Spring Boot Profiles实现多环境下配置切换
- spring-boot:run启动时,指定spring.profiles.active