snakeyamlwildfly-swarmthorntail

Get access to yaml external file in Thorntail


I want to get access to external YAML file which I specify through command-line argument:

java -jar target/app-thorntail.jar -s./test.yaml

This file I need to use to get my custom properties tree by SnakeYaml.


Solution

  • You can use @Inject @ConfigurationValue for your custom properties, and you can @Inject a ConfigView to read the entire configuration tree. I believe that should be enough for your usecase. This approach will also provide correct values in case multiple configuration files are used.

    I'm not sure if you can get access to the file itself, except maybe provide a custom main method and parse the command-line arguments yourself.