spring boot read properties from yml file

后端 未结 3 1510
再見小時候
再見小時候 2020-12-22 01:00

I have a spring boot application where properties have to be read from a yaml file.

code:

@Component
@PropertySource(\"classpath:application.yml\")
p         


        
3条回答
  •  囚心锁ツ
    2020-12-22 01:40

    from the documentation:

    YAML files cannot be loaded by using the @PropertySource annotation. So, in the case that you need to load values that way, you need to use a properties file.

    Official spring boot documentation reference

提交回复
热议问题