简体   繁体   English

Dropwizard:在应用程序之间共享配置

[英]Dropwizard: Sharing configuration between applications

Is there a architecturally correct way of sharing common configuration, such as Database and Messaging Provider connection details, across different Dropwizard applications? 是否有一种体系结构正确的方法可以在不同的Dropwizard应用程序之间共享通用配置,例如数据库和消息提供程序连接详细信息?

Thanks. 谢谢。

I don't know about architecurally correct ..... :-) 我不知道从建筑学上来说是正确的 .. :-)

I would make a base Configuration class and stuff it in a common artifact that all dropwizard applications can depend on. 我将创建一个基本的Configuration类,并将其填充到所有dropwizard应用程序都可以依赖的通用工件中。 (Assuming maven but should work with any build system.) In this base class you can have all configuration that is similar between applications. (假设使用maven,但应可与任何构建系统一起使用。)在此基类中,您可以拥有应用程序之间相似的所有配置。 You will still need to add the actual values to a yml file per application. 您仍然需要将每个应用程序的实际值添加到yml文件中。 You don't want to have these values in your source code anyway so that is fine. 无论如何,您都不想在源代码中包含这些值,这很好。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM