1:
properties文件中用${名称}
redis.day.two=${redis_day_two}
2:
pom文件中(build同级)
<profiles> <profile> <id>local</id> <activation> <activeByDefault>true</activeByDefault> //默认 </activation> <properties> <build.profile.id>local</build.profile.id> //变量 </properties> <build> <filters> <filter>profiles/${build.profile.id}/config.properties</filter> //在这个文件中查找 </filters> <resources> <resource> <filtering>true</filtering> <directory>src/main/resources</directory> //目录配置文件目录 </resource> </resources> </build> </profile> <profile>...</profile>#其它profile </profiles>
3:
mvn命令
mvn package -P local
补充profiles 与src同级