赞
踩
配置pom.xml
- <?xml version="1.0" encoding="UTF-8"?>
-
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>test</groupId>
- <artifactId>test6</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>war</packaging>
-
- <name>test6 Maven Webapp</name>
- <!-- FIXME change it to the project's website -->
- <url>http://www.example.com</url>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.7</maven.compiler.source>
- <maven.compiler.target>1.7</maven.compiler.target>
- </properties>
-
- <profiles>
- <profile>
- <id>dev</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <properties>
- <profiles.active>dev</profiles.active>
- </properties>
- </profile>
- <profile>
- <id>pro</id>
- <properties>
- <profiles.active>pro</profiles.active>
- </properties>
- </profile>
- <profile>
- <id>test</id>
- <properties>
- <config>test</config>
- </properties>
- </profile>
- </profiles>
-
- <build>
- <finalName>${project.artifactId}</finalName>
- <resources>
- <resource>
- <directory>src/main/resources/config</directory>
- <!--
- exclude可以排除指定文件,支持通配符 ,匹配项不会生成到classes目录下,路径是以directory开始的
- 在这里就是directory(src/main/resources/)/properties/env/pro.properties
- -->
- <excludes>
- <exclude>test/*</exclude>
- <exclude>pro/*</exclude>
- <exclude>dev/*</exclude>
- </excludes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </build>
- </project>
配置properties文件
1.application.properties
2.dev.properties
3.pro.properties
4.test.properties
配置application.properties
p_datasources=${datasources}
p_port=${port}
p_name=${name}
p_password=${password}
配置dev/test/pro.properties
datasources=dev
port=1521
name=test
password=123
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。