How I can load properties from yml?

I am developing a spring application and the following question arose:

  • How I can load properties from yml file instead adding via Java?
    config.yml located in resources folder.
    My snippet:
public class GraphHopperConfig {

   * Bean for GraphHopper
   * @return
  public GraphHopper graphHopper() {
   com.graphhopper.GraphHopperConfig graphHopperConfig = new com.graphhopper.GraphHopperConfig();
   GraphHopper hopper = new GraphHopperOSM().forServer();

   return hopper;


When I try to start app GraphHopper not seeing the config.yml file.

Using the config.yml is only possible when you use dropwizard.

1 Like

Thanks for the quick response.
I found this topic - Loading GraphHopperServerConfiguration from a single file

Here it is indicated that you can load the configuration from the config.yml

GraphHopperConfig config = <load config from a file>
GraphHopper graphHopperEngine = new GraphHopper().forMobile();

Those. there is no way to load the configuration using GraphHopperConfig?

Sure, you can try a yaml parser and load the GraphHopperConfig from there, but there is no inbuilt method for this or something.

1 Like

Thank you so much and have a nice day!

Powered by Discourse