我想为DropWizard安装几个yaml文件.其中一个包含敏感信息和一个非敏感信息.
你可以指出我在DropWizard中有多个配置的任何文档或示例?
解决方法
ConfigurationSourceProvider是你的答案.
bootstrap.setConfigurationSourceProvider(new MyMultipleConfigurationSourceProvider());
以下是如何dropwizard does it by default.您可以轻松地将其更改为您自己的喜好.
public class FileConfigurationSourceProvider implements ConfigurationSourceProvider { @Override public InputStream open(String path) throws IOException { final File file = new File(path); if (!file.exists()) { throw new FileNotFoundException("File " + file + " not found"); } return new FileInputStream(file); } }