1、添加maven配置在pom文件中
<profile>
    <id>prod</id>
    <properties>
        <autoconfig.userProperties>src/filter/develop.properties</autoconfig.userProperties>
    </properties>
</profile>
 
<plugin>
    <groupId>com.alibaba.citrus.tool</groupId><!--配置文件的工具-->
    <artifactId>autoconfig-maven-plugin</artifactId>
    <version>${autoconfig.plugin.version}</version>
    <configuration>
        <userProperties>${autoconfig.userProperties}</userProperties>
    </configuration>
    <executions>
    <execution>
        <phase>package</phase>
        <goals>
            <goal>autoconfig</goal>
        </goals>
    </execution>
</executions>
</plugin>
2、配置autoconfig文件
 
-----------------------------------------------------配置详解---------------------------------------------------------
(1)文件必须在META-INF下的autoconf文件夹下
(2)配置develop.properties
   logger.error.appender  = liushuai
(3)配置auto-config.xml
 
 
<config>
    <group name="logger">   //配置字段名称和默认值还有备注(可以分组,只是标记而已)
        <property  name="logger.error.appender " defaultValue="haha" description="日志打印级别"/>
    </group>
<!-- 文件生成配置 -->
<script>//配置模板位置和生成文件的地址
    <generate template="META-INF/autoconf/develop.properties.vm" destfile="WEB-INF/classes/properties/develop.properties"
              charset="UTF-8"/>
</script>
</config>
(4)配置config.properties.vm
      logger.error.appender  = ${logger.error.appender}
     // ${logger.error.appender}与xml中的name 一样(红色字体的名称只是为了转化为配置文件而已)
(5)开始打包啦
     打完后,配置文件会根据模板生成在WEB-INF/classes/properties/develop.properties

 
注意:
1、对于.properties、vm、xml、中的字段来说,xml、vm必须一致,但是properties随意啦

 

最新文章

  1. PRINCE2的思维结构
  2. Dom 概览
  3. [vijos1264]神秘的咒语(LCIS)
  4. Oracle监听启动失败问题
  5. 06 Linux下Shell介绍
  6. XC一键锁屏应用
  7. linux“批处理”脚本
  8. Python读取txt文件
  9. PSR
  10. 使用webpack-dev-middleware 和 webpack-hot-middleware 配置一个dev-server
  11. Session、Cookie 学习笔记
  12. LAMP_yum安装
  13. Django 1.11 release note简明解读
  14. afn3.0源码解析---AFURLRequestSerialization
  15. Windows下安装Redis服务
  16. Xadmin 组件基础使用以及全局配置
  17. redis编译问题
  18. 区间dp的一些模式和总结
  19. TF-IDF原理与实现
  20. Oracle学习笔记:a inner join b与from a,b where a.x=b.x的差异

热门文章

  1. Dreamer 框架 比Struts2 更加灵活
  2. Oracle 数据备份、恢复以及导入时表空间不存在的解决方案
  3. iOS 10 之后,相机权限问题及易出现的Crash
  4. 常见sql语句
  5. Base64加密与解密
  6. [Q]“获取AutoCAD安装信息时失败...”解决方法
  7. C# 语言规范_版本5.0 (第20章 附录B_语法)
  8. .net c#通过Exif获取图片信息(参数)
  9. python中的二维数组90度旋转
  10. 使用 voluptuous 校验数据