一. 在springBoot项目中读取 .yml配置文件

      1.示例在application.yml 存在   profile: /tjzy/uploadPath

        SpringBoot中读取yml配置文件或SpringMVC中读取properties文件

      2.用法如下图,Global、YamUtil、StringUtil 三个工具类在工具类压缩包

   SpringBoot中读取yml配置文件或SpringMVC中读取properties文件

 

二. SpringMVC项目中读取 .properties 配置文件

      1.示例在config.properties配置文件中存在 redis.host=192.168.x.x

        SpringBoot中读取yml配置文件或SpringMVC中读取properties文件

       2.用法示例,在JedisUtils类获取congfig.properties中的redis.host

       SpringBoot中读取yml配置文件或SpringMVC中读取properties文件

      3. getValueByKey方法详见Config类,Config类在工具类压缩包。

相关文章:

  • 2021-11-19
  • 2022-12-23
  • 2021-07-27
  • 2022-02-08
  • 2021-05-31
  • 2022-02-08
  • 2021-07-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2021-04-11
  • 2022-12-23
相关资源
相似解决方案