springboot 国际化如何将.properties文件替换为.yml文件?

 

如图,使用.properties文件时,key是一种连点的形式。目前的项目想要换成.yml文件,层级结构看起来清晰。

要如何做?

1,先将properties文件里的内容复制出来转换成yml格式,网上有在线转换工具。

2,建一个yml文件,放进去就好了

就这么简单

对你有用请采纳有用请采纳有用请采纳有用请采纳有用请采纳

直接重命名 没问题的 springboot认得它

server:
  port: 8081

spring:
  datasource:
    continueOnError: true
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: 数据库地址
    username: radius
    password: t1j2ylpx
    druid:
      initial-size: 5
      max-active: 20
      max-wait: 60000
      time-between-eviction-runs-millis: 60000
      min-evictable-idle-time-millis: 300000
      validation-query: SELECT 1 from DUAL
      test-on-return: false
      test-on-borrow: false
      test-while-idle: true
      pool-prepared-statements: true
      filters: encoding
      max-pool-prepared-statement-per-connection-size: 20
      use-global-data-source-stat: true
      connectionProperties: clientEncoding=GB2312;serverEncoding=ISO-8859-1

##日志配置
#logging.level.com.dalaoyang.dao.UserMapper=debug
logging:
  level:
    root: info

##mybatis-plus mapper xml 文件地址
mybatis-plus:
  mapper-locations: classpath*:mapper/*Mapper.xml