autoconfig操作小结
2024-08-29 09:13:22
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随意啦
最新文章
- PRINCE2的思维结构
- Dom 概览
- [vijos1264]神秘的咒语(LCIS)
- Oracle监听启动失败问题
- 06 Linux下Shell介绍
- XC一键锁屏应用
- linux“批处理”脚本
- Python读取txt文件
- PSR
- 使用webpack-dev-middleware 和 webpack-hot-middleware 配置一个dev-server
- Session、Cookie 学习笔记
- LAMP_yum安装
- Django 1.11 release note简明解读
- afn3.0源码解析---AFURLRequestSerialization
- Windows下安装Redis服务
- Xadmin 组件基础使用以及全局配置
- redis编译问题
- 区间dp的一些模式和总结
- TF-IDF原理与实现
- Oracle学习笔记:a inner join b与from a,b where a.x=b.x的差异
热门文章
- Dreamer 框架 比Struts2 更加灵活
- Oracle 数据备份、恢复以及导入时表空间不存在的解决方案
- iOS 10 之后,相机权限问题及易出现的Crash
- 常见sql语句
- Base64加密与解密
- [Q]“获取AutoCAD安装信息时失败...”解决方法
- C# 语言规范_版本5.0 (第20章 附录B_语法)
- .net c#通过Exif获取图片信息(参数)
- python中的二维数组90度旋转
- 使用 voluptuous 校验数据