Java – can I have multiple profiles in the dropwizard?
•
Java
I want to install several yaml files for the dropwizard One of them contains sensitive information and one non - sensitive information
Can you point out any documents or examples where I have multiple configurations in the dropwizard?
Solution
Configurationsourceprovider is your answer
bootstrap.setConfigurationSourceProvider(new MyMultipleConfigurationSourceProvider());
Here is how to dropwizard does it by default You can easily change it to your own preference
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); } }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码