Spring Boot: Load @Value from YAML file

前端 未结 6 1777
一整个雨季
一整个雨季 2020-12-28 14:23

I need to load a property from a .yml file, which contains the path to a folder where the application can read files from.

I\'m using the following code

6条回答
  •  醉梦人生
    2020-12-28 15:02

    For example: application.yml

    key:
     name: description here
    

    Your Class:

    @Value("${key.name}")
    private String abc;
    

提交回复
热议问题