springmvc多环境配置-profiles
1 pom.xml 添加 profiles 标签
<profiles>
<!--pro 线上环境-->
<profile>
<id>hdapp_pro</id>
<properties>
<db.main.url>jdbc:oracle:thin:@ip:1521:orcl</db.main.url>
<db.mian.username>username</db.mian.username>
<db.main.password>password</db.main.password>
</properties>
<activation> 配置默认使用哪个环境
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<!-开发环境环境-->
<profile>
<id>hdapp_dev</id>
<properties>
<db.main.url>jdbc:oracle:thin:@ip:1521:orcl</db.main.url>
<db.mian.username>username</db.mian.username>
<db.main.password>password</db.main.password>
</properties>
</profile>
</profiles>
2 在resources 下新配置文件 jdbc.properties 内容如下
jdbc.url = ${db.main.url}
jdbc.username =${db.mian.username}
jdbc.password =${db.main.password}
3 在pom.xml build 中添加扫描的文件
<build>
<resources>
<resource>
<directory>src/main/resources/</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>src/main/resources/</directory>
<includes> //可以写多个
<include>config/jdbc.properties</include>
<include>quartz/scan-quartz.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
4 打包时指定profiles 即可
打包命令添加参数 -P
clean package -P hdapp_dev
springmvc多环境配置-profiles的更多相关文章
- idea spring+springmvc+mybatis环境配置整合详解
idea spring+springmvc+mybatis环境配置整合详解 1.配置整合前所需准备的环境: 1.1:jdk1.8 1.2:idea2017.1.5 1.3:Maven 3.5.2 2. ...
- Shiro笔记(二)Shiro集成SpringMVC的环境配置
0.pom文件引入 <!-- SECURITY begin --> <dependency> <groupId>org.apache.shiro</group ...
- spring程序打包war,直接通过-jar启动,并指定spring.profiles.active参数控制多环境配置
备注:spring boot有内嵌tomcat,jar项目可以用java -jar命令启动,war包也可以,且可以直接指定spring.profiles.active参数控制多环境配置 直接指定传参, ...
- maven profiles多环境配置
maven profiles多环境配置 转载. https://blog.csdn.net/runbat/article/details/81747874 今天做了一个小项目,需要配置开发.测试.预发 ...
- SpringBoot Profiles 多环境配置及切换
目录 前言 默认环境配置 多环境配置 多环境切换 小结 前言 大部分情况下,我们开发的产品应用都会根据不同的目的,支持运行在不同的环境(Profile)下,比如: 开发环境(dev) 测试环境(tes ...
- Maven2-profile多环境配置
使用maven管理项目有一个好处是就是可以针对不同的环境使用不同的编译打包设置,方便了多环境下的打包部署,一般我们开发项目都会有至少开发环境和正式环境两个,针对这两个环境的配置信息也会有所不同,比如数 ...
- Maven-001-初识及本地环境配置
前段时间想对自己之前写的一些代码或者小工具,因为写的比较乱,因而想系统的管理一下自己学习 Java 时写的源码,经过多方请教.网上查询,最终决定使用 Maven 来管理自己写的代码. Maven 是一 ...
- [转载] 高效MacBook工作环境配置
原文: http://www.xialeizhou.com/?p=71 高效MacBook工作环境配置 发表于 2015 年 8 月 1 日 由 xialeizhou 本文记录整个配置过程,供新入手M ...
- activiti自定义流程之自定义表单(一):环境配置
先补充说一下自定义流程整个的思路,自定义流程的目的就是为了让一套代码解决多种业务流程,比如请假单.报销单.采购单.协作单等等,用户自己来设计流程图. 这里要涉及到这样几个基本问题,一是不同的业务需求, ...
随机推荐
- loj2305 NOI2017 游戏
题目链接 思路 既然\(x\)的数量那么小,我们就可以先把每个\(x\)搜索一遍. 枚举x的时候不需要把\(a,b,c\)全枚举一遍,只要枚举其中的两个就可以枚举到当前位置选任何车的情况. 然后就变成 ...
- [LeetCode] 145. Binary Tree Postorder Traversal 二叉树的后序遍历
Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary ...
- 关于指针与引用的差别——C++
准备 https://zhuanlan.zhihu.com/p/27974028 开始 int 是int类型变量声明 int * 是int指针声明,指针其实就是地址变量,用来储存地址值的" ...
- .NetCore 入门篇:理解
(良心转载)原文地址:https://ken.io/note/dotnet-core-qucikstart-preface 一..NET Core的诞生 聊 .NET Core,就不得不说他的爸爸 . ...
- mybatis使用associaton进行分步查询
Employee类 public class Employee { private Integer id; private String lastName; private String email; ...
- Jenkins生成APK链接的二维码
Window环境 1.下载安装Python如3.7.5版本,安装Python到电脑上如C:\Python37,将C:\Python37,C:\Python37\Scripts添加到Path环境变量中 ...
- windows下生成ssl
1.安装git window 需要安装 git 按部就班即可 https://git-scm.com/ 2.安装完之后,打开 Git Bash 输入以下命令并执行,然后一路按“回车”即可,效果见图: ...
- windows通过秘钥使用ssh和scp
windows10内置支持了ssh和scp等仿linux指令,可以让我们方便的使用类似linux的工作流把日常的代码资源部署维护工作写成脚本(批处理). ssh和scp都有-i参数可以通过指定一个私钥 ...
- 【VS2019】Web项目发布时提示无法连接FTP服务器
使用 Visual Studio 2019 时出现的问题 环境:win10 ltsc 场景 发布Web项目到FTP时 失败,并提示 _无法打开网站"ftp://...".未安装与 ...
- SprintBoot 实现上传下载
本人在 .NET 转JAVA 的路上 ,也在学习SpringBoot相关知识,这里记录一下在Springboot中实现文件上传下载的核心代码 package com.file.demo.springb ...