简体   繁体   English

带有eclipse microprofile-config的自定义配置文件

[英]Custom config file with eclipse microprofile-config

I want to select .properties file at runtime. 我想在运行时选择.properties文件。 Is it possible with microprofile-config? microprofile-config是否可以? So, instead of using META-INF/microprofile-config.properties I would like to use an external file: 因此,我不想使用META-INF / microprofile-config.properties,而是要使用一个外部文件:

java -jar mymicroprofileapp.jar -s my.properties

I know, it is possible to write custom config source, but I wonder if there is a built-in option to define the config file and so avoiding repeating the code in each project 我知道,可以编写自定义配置源,但是我想知道是否有内置选项来定义配置文件,因此避免在每个项目中重复代码

The web site tells us the three options: 该网站告诉我们三个选项:

  • System.getProperties()
  • System.getenv()
  • META-INF/microprofile-config.properties . META-INF/microprofile-config.properties

I addition to these you can register ConfigSources . 除了这些,您还可以注册ConfigSources

There is no build-in option for what you want. 没有您想要的内置选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在自定义 OASFilter 处理期间,Microprofile 配置注入是 null,并且 microprofile-config.propetries 不被视为配置源 - Microprofile Config injection is null during custom OASFilter processing and microprofile-config.propetries is not considered as config source 在 Helidon MP 中外部化 microprofile-config.properties 文件的任何方式 - Any way to Externalize microprofile-config.properties file in Helidon MP 如何模拟配置提供程序类 (org.eclipse.microprofile.config.ConfigProvider) - How to Mock Config Provider Class ( org.eclipse.microprofile.config.ConfigProvider) 微型轮廓| 配置-使用动态值进行测试 - Microprofile | Config - Testing with dynamic values 自定义配置文件默认值 - custom config file defaults Thorntail中MicroProfile Config实现的可移植性问题 - Portability issue with MicroProfile Config implementation in Thorntail Eclipse运行配置本地文件 - Eclipse run config local file Eclipse RCP产品中的自定义config.ini - Custom config.ini in Eclipse RCP product 解析自定义xml配置文件 - Parsing custom xml config file Eclipse ant任务使用自定义WIX配置文件(wxs)文件而不是默认wxs文件 - Eclipse ant task use custom WIX config file (wxs) file instead default wxs file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM