相关知识(简述)
SpringBoot profile:
SpringBoot允许我们在配置文件(以application.properties示例)中通过配置spring.profiles.active=xxx,来对应激活application-xxx.properties配置,这就是SpringBoot profile。
Maven profile:
Maven允许我们在配置文件(项目pom.xml文件或maven的settings.xml文件)中配置多个profile,并通过mvn指令或触发器指定激活那个(或哪些)profile。
注:关于maven profile的相关知识考https://blog.csdn.net/justry_deng/article/details/100537571
SpringBoot profile整合Maven profile实现多环境配置、依赖自动切换
第一步:准备SpringBoot的profile(即:准备相关配置文件)。
第二步:根据自己的实际需求,在pom.xml中,准备Maven 的profile。
第三步:将Maven profile与SpringBoot profile关联起来。
第四步:在系统配置文件中application.properties中,动态获取pom.xml里的激活环境标识。
第五步:测试一下。
clean install -P dev-id
clean install -P test-id
clean install -P pre-id
clean install -P prod-id
参考:https://blog.csdn.net/justry_deng/article/details/100544886
代码托管:springboot_profile