如何防止应用程序。Properties属性继承
假设我有一个 src/main/ressources/application.properties
包含以下(示例性)条目:
server.ssl.trust-store=/config/app.jks
和多个application.properties for多个环境
/config
|---/prod
| |---/application.properties // overrides "server.ssl.trust-store"
|---/int
|---/application.properties
/src
|---/main
|---/resources
|---/application.properties // contains entry "server.ssl.trust-store"
application.properties。目录从src/main/resources/application.properties继承。在/config/prod/application.properties中,我们要覆盖条目。这一切都按预期工作。
现在,我的问题是:是否有可能抑制财产的继承? 我尝试用空价值覆盖它,但这没有起作用,并且被不同的解释为完全没有设置。
注意:对于这种特殊情况,我知道 server.ssl.enabled = false
( source )。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以创建一个新的Spring配置文件,例如
ssl
,并在此处添加SSL配置,然后可以通过“导入” SSL配置文件来按需在应用中启用这些配置。
您会忽略此陈述,而您不想拥有该价值。
另一种方法是在
application.properties
中直接配置条件属性。You could create a new spring profile, for example,
ssl
, and add the ssl configurations thereYou can then enable these configurations in your apps on demand by "importing" the ssl profile.
You would leave out this statements where you wouldn't want to have that value present.
Another way is to directly configure conditional properties in the
application.properties