如何为MessageBundle加载外部msg.properties?

问题描述 投票:0回答:1

我正在使用 Qute 和 Quarkus 并定义了我的

messages/msg.properties
文件。它按预期工作。我想要实现的是从外部配置加载
msg.properties
文件。

基于这篇文章配置源,运行本机应用程序时,我已将属性文件添加到

$PWD/config/
文件夹中 - 所以它位于
$PWD/config/messages/msg.properties
下。不幸的是,这仍然没有加载。

我怎样才能从外部源加载属性?

quarkus quarkus-qute
1个回答
0
投票

按照页面中所述定义多个位置https://quarkus.io/guides/config-reference#locations

除了默认配置位置之外,Quarkus 还提供了一种扫描其他位置以查找配置属性文件的方法。

quarkus.config.locations 配置属性接受用逗号分隔的多个位置,并且每个位置都必须代表一个有效的 URI。支持的 URI 方案有:

  • 文件或目录(文件:)
  • 类路径资源
  • jar资源(jar:)
  • http 资源 (http:)

只要流程用户有权访问

quarkus.config.locations
中定义的那些路径,它就应该可以工作。示例

quarkus.config.locations=management/organization/security/datasource.properties,management/organization/security/network.properties

查看此处了解更多示例。

© www.soinside.com 2019 - 2024. All rights reserved.