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的更多相关文章

  1. 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. ...

  2. Shiro笔记(二)Shiro集成SpringMVC的环境配置

    0.pom文件引入 <!-- SECURITY begin --> <dependency> <groupId>org.apache.shiro</group ...

  3. spring程序打包war,直接通过-jar启动,并指定spring.profiles.active参数控制多环境配置

    备注:spring boot有内嵌tomcat,jar项目可以用java -jar命令启动,war包也可以,且可以直接指定spring.profiles.active参数控制多环境配置 直接指定传参, ...

  4. maven profiles多环境配置

    maven profiles多环境配置 转载. https://blog.csdn.net/runbat/article/details/81747874 今天做了一个小项目,需要配置开发.测试.预发 ...

  5. SpringBoot Profiles 多环境配置及切换

    目录 前言 默认环境配置 多环境配置 多环境切换 小结 前言 大部分情况下,我们开发的产品应用都会根据不同的目的,支持运行在不同的环境(Profile)下,比如: 开发环境(dev) 测试环境(tes ...

  6. Maven2-profile多环境配置

    使用maven管理项目有一个好处是就是可以针对不同的环境使用不同的编译打包设置,方便了多环境下的打包部署,一般我们开发项目都会有至少开发环境和正式环境两个,针对这两个环境的配置信息也会有所不同,比如数 ...

  7. Maven-001-初识及本地环境配置

    前段时间想对自己之前写的一些代码或者小工具,因为写的比较乱,因而想系统的管理一下自己学习 Java 时写的源码,经过多方请教.网上查询,最终决定使用 Maven 来管理自己写的代码. Maven 是一 ...

  8. [转载] 高效MacBook工作环境配置

    原文: http://www.xialeizhou.com/?p=71 高效MacBook工作环境配置 发表于 2015 年 8 月 1 日 由 xialeizhou 本文记录整个配置过程,供新入手M ...

  9. activiti自定义流程之自定义表单(一):环境配置

    先补充说一下自定义流程整个的思路,自定义流程的目的就是为了让一套代码解决多种业务流程,比如请假单.报销单.采购单.协作单等等,用户自己来设计流程图. 这里要涉及到这样几个基本问题,一是不同的业务需求, ...

随机推荐

  1. ABP 下载源码报错

    ASP.NET Boilerplate 下载地址应该是这个:https://github.com/aspnetboilerplate/aspnetboilerplate/tree/v1.5.2 下载的 ...

  2. NCBI之UniVec数据库及去载体

    1.数据库简介 UniVec是一个数据库,可用于快速识别核酸序列中可能来自载体来源(载体污染)的片段.使用UniVec进行筛选是高效的,因为已经消除了大量冗余子序列,从而创建一个只包含来自大量载体的每 ...

  3. [LeetCode] 917. Reverse Only Letters 只翻转字母

    Given a string S, return the "reversed" string where all characters that are not a letter  ...

  4. [LeetCode] 85. Maximal Rectangle 最大矩形

    Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and ...

  5. [LeetCode] 719. Find K-th Smallest Pair Distance 找第K小的数对儿距离

    Given an integer array, return the k-th smallest distance among all the pairs. The distance of a pai ...

  6. NTT&FFT(快速?变换)

    NTT&FFT 预先知识:无 我觉得我们可以从NTT/FFT讲起? 两个其实本质相同,都是求 多项式乘积 的算法 FFT \((x,y)\)指复数,我们可以不用管它 首先我们构造单位根\(\o ...

  7. Elasticsearch由浅入深(六)批量操作:mget批量查询、bulk批量增删改、路由原理、增删改内部原理、document查询内部原理、bulk api的奇特json格式

    mget批量查询 批量查询的好处就是一条一条的查询,比如说要查询100条数据,那么就要发送100次网络请求,这个开销还是很大的如果进行批量查询的话,查询100条数据,就只要发送1次网络请求,网络请求的 ...

  8. 利用Jenkins打包并远程部署NodeJS应用

    本文Jenkins版本2.190.2,为19年11月最新 1.安装Jenkins.Git和NodeJS Jenkins安装参考:https://www.cnblogs.com/zhi-leaf/p/1 ...

  9. EventBus原理解析

    前言 EventBus的核心思想是观察者模式 (生产/消费者编程模型) . SpringBoot+EventBus使用教程(一) SpringBoot+EventBus使用教程(二) 通过前面的文章我 ...

  10. C++:= delete

    = delete delete的由来 如之前提到的,在没有声明默认特殊成员函数的时候,编译器会自动帮我们补充,但有时候我们并不希望存在这些函数,比如:我们不希望某个类通过拷贝的方式实例化一个新的对象. ...