首先在resources目录下新建一个properties文件,如下图

 springboot properties文件中的数据通过@Value()形式注入

在photoPath.properties中写入内容,key=value的形式,如下图

springboot properties文件中的数据通过@Value()形式注入

在你需要引用properties的类头部加入如下注解,并且通过@Value()的方式将值注入

springboot properties文件中的数据通过@Value()形式注入

 

相关文章:

  • 2022-12-23
  • 2021-09-21
  • 2021-10-30
  • 2021-04-23
  • 2022-01-13
  • 2022-12-23
  • 2022-03-02
  • 2021-05-16
猜你喜欢
  • 2021-12-14
  • 2021-09-13
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2021-11-05
  • 2022-01-24
相关资源
相似解决方案