java - 如何在 Spring Boot War 中包含特定的 applicaction.properties
问题描述
我需要为 spring boot 项目创建不同的应用程序属性,并在生成的战争中包含正确的属性。我能够产生战争,但不能在其中包含正确的文件。我创建了不同的配置文件,并且在模式 application-env.properties 之后创建了不同的 application.properties,其中 env 是(dev,cert ...),然后所有这些都放在 src/main/resources 但我无法选择正确的一个并包含在生成的战争中,甚至包括“-Dspring.profiles.active=cert”来定义活动的配置文件。战争是由他们所有人产生的。任何想法?
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<build.profile.id>dev</build.profile.id>
<packaging.type>jar</packaging.type>
<spring.profiles.active>dev</spring.profiles.active>
</properties>
</profile>
<profile>
<id>cert</id>
<properties>
<build.profile.id>cert</build.profile.id>
<spring.profiles.active>cert</spring.profiles.active>
<packaging.type>war</packaging.type>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
解决方案
推荐阅读
- web-services - SSRS - 将复杂的参数传递给 Web 服务
- pandas - Pandas - 将多列中的数据(列表)吐到新行中
- python-3.x - 不知道为什么 != 在 == 起作用时不起作用
- push-notification - Android 的 PWA 上缺少推送数据,但桌面上没有
- c# - Visual Studio Nuget Manager 报告自定义 Nuget 的 .NETStandard2.0 部分“不受支持”
- http - 如何修复 Vuejs“未捕获的异常:对象”GET 请求
- r - R 格式仅适用于整数,删除小数
- java - 更新元数据后发现不适用于 GridFS
- c# - 我如何在没有条件的情况下跳转到表中的下一行?
- r - 在R中将序列移动一定间隔