Read properties by dynamic keys in spring boot

前端 未结 2 798
南旧
南旧 2020-12-09 19:24

I wanted to know if there is any way in Spring Boot to read property values from properties file by using Dynamic Keys. I know properties can be put in applic

2条回答
  •  死守一世寂寞
    2020-12-09 20:13

    you can use:

    @Autowired
    private Environment env;
    

    and then load property from code:

    env.getProperty("your.property")
    

提交回复
热议问题