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. 爬虫之获取UA模块

    from fake_useragent import UserAgent ua = UserAgent(verify_ssl=False)res = ua.randomprint(res) 注: 实列 ...

  2. 获取本地连接ip地址(通用版)

    @echo off & setlocal enabledelayedexpansionrem 如果系统中有route命令,优先采用方案1:for /f "tokens=3,4&quo ...

  3. inputType导致TextView不能多行显示

    今天遇到一个问题很纳闷,那就是TextView不能自动换行多行显示,因为我的印象是TextView默认是可以自动换行多行显示的,今儿个怎么就不行呢. 最终找到原因,是因为设置了inputType属性导 ...

  4. [转载]3.2 UiPath鼠标操作文本的介绍和使用

    一.鼠标(mouse)操作的介绍 模拟用户使用鼠标操作的一种行为,例如单击,双击,悬浮.根据作用对象的不同我们可以分为对元素的操作.对文本的操作和对图像的操作 二.鼠标对文本的操作在UiPath中的使 ...

  5. js 宏任务和微任务

    .宏任务(macrotask )和微任务(microtask ) macrotask 和 microtask 表示异步任务的两种分类. 在挂起任务时,JS 引擎会将所有任务按照类别分到这两个队列中,首 ...

  6. Vue双向绑定原理(我尽量写的。简洁)

    先问自己两个问题: 1.app.message修改数据的时候,Vue内部是如何监听message数据发生改变的 使用Object.defineProperty ->监听对象属性的改变 2.当数据 ...

  7. Xamarin vs React Native vs Ionic vs NativeScript: Cross-platform Mobile Frameworks Comparison

    CONTENTS Reading time: 14 minutes Cross-platform mobile development has long been a viable alternati ...

  8. golang 学习笔记 ---new()和 make()的区别详解

    概述 Go 语言中的 new 和 make 一直是新手比较容易混淆的东西,咋一看很相似.不过解释两者之间的不同也非常容易. new 的主要特性 首先 new 是内建函数,你可以从 http://gol ...

  9. Python 3 的 int 类型详解(为什么 int 不存在溢出问题?)

    在以前的Python2中,整型分为int和long,也就是整型和长整型, 长整型不存在溢出问题, 即可以存放任意大小的数值,理论支持无限大数字. 因此在Python3 中,统一使用长整型,用int表示 ...

  10. Centos 7.6 安装 oracle 10.2.0.1 数据库软件

    step 1: 编辑 /etc/redhat-release :内容为redhat-4 step 2: 安装32位的软件包:yum install libXp.i686  libXt.i686  li ...