spring boot 不同的环境使用不同的配置
来源:互联网 发布:雷姆雷姆软件汉化版 编辑:程序博客网 时间:2024/05/16 06:14
server: tomcat: uri-encoding: UTF-8 max-threads: 1000 min-spare-threads: 30 port: 80# 默认的profile为dev,其他环境通过指定启动参数使用不同的profile,比如: # 测试环境:java -jar my-spring-boot.jar --spring.profiles.active=test # 生产环境:java -jar my-spring-boot.jar --spring.profiles.active=prod# java -jar my-spring-boot.jar -Dspring.profiles.active=prod 二者选一# 以下是配置默认环境spring: profiles: active: dev --- # 开发环境配置 spring: profiles: dev datasource: url: jdbc:mysql://localhost:3306/dev?useUnicode=true&characterEncoding=UTF-8 username: root password: root--- # 测试环境配置 spring: profiles: test datasource: url: jdbc:mysql://localhost:3306/test?&useUnicode=true&characterEncoding=UTF-8 username: root password: root --- # 生产环境配置 spring: profiles: prod datasource: url: jdbc:mysql://localhost:3306/prod?useUnicode=true&characterEncoding=UTF-8 username: root password: root
总结:
spring-boot:run启动时,指定profiles
1、Maven启动指定Profile通过-P,如mvn spring-boot:run -Ptest,但这是Maven的Profile。
2、使用spring-boot的spring.profiles.active,则必须使用mvn spring-boot:run -Drun.profiles=test
3、使用命令行直接运行jar文件,则使用java -jarbattle-0.0.1-SNAPSHOT.jar-Dspring.profiles.active=test 或--spring.profiles.active=test
阅读全文
0 0
- spring boot 不同的环境使用不同的配置
- spring boot 不同的环境使用不同的配置
- Spring-Boot使用profile来配置不同环境的配置文件
- Spring Boot在不同环境的动态配置
- spring profile来用不同的文件,配置不同的环境, deploy不同的war
- spring-boot在不同的环境启动加载不同的配置文件
- spring boot的使用以及环境配置
- spring使用PropertyPlaceholderConfigurer扩展来满足不同环境的参数配置
- spring使用PropertyPlaceholderConfigurer扩展来满足不同环境的参数配置
- spring使用PropertyPlaceholderConfigurer扩展来满足不同环境的参数配置
- spring使用PropertyPlaceholderConfigurer扩展来满足不同环境的参数配置
- spring使用PropertyPlaceholderConfigurer扩展来满足不同环境的参数配置
- spring使用PropertyPlaceholderConfigurer扩展来满足不同环境的参数配置
- spring boot profiles根据不同环境指定不同配制
- 52. spring boot日志升级篇—log4j多环境不同日志级别的控制【从零开始学Spring Boot】(
- 52. spring boot日志升级篇—log4j多环境不同日志级别的控制【从零开始学Spring Boot】
- 52. spring boot日志升级篇—log4j多环境不同日志级别的控制【从零开始学Spring Boot】
- Spring MVC 根据不同环境加载不同的配置文件
- Android 异步消息处理机制 让你深入理解 Looper、Handler、Message三者关系
- java String StringBuffer StringBudlider 区别
- MySQL 分区表以及操作
- 套接字、UDP通信、TCP通信、TCP\IP协议簇
- Django学习笔记二:实现博客详情,完善文章的分类和标签
- spring boot 不同的环境使用不同的配置
- DevExpress GridControl 各属性作用
- Linux与Windows平台无关后台服务应用程序实现
- 透明显示屏
- 用SetUpDi系列函数获得系统设备信息
- Servlet初步
- Eratosthenes筛法(素数筛法)
- 算法系列——Partition List
- HashTable----- List 299. Bulls and Cows