SpringCloudConfig对称加密 yml配置文件while parsing a block mapping

 

 

 

 

 错误的配置!!!

#-----------------db------------------
mybatis:
  type-aliases-package: com.book.product.pojo
  mapper-locations: classpath:com/book/product/mapper/*.xml

spring:
  datasource:
    url: jdbc:mysql:///book-product?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
    username: {cipher}24583ad4b96a662ad323fce2e452a7cd9f7c7d276d17511e3e1226398e6b7e92
    password: {cipher}ca62ef4d6b3fec3cbc75aeca077c81c5923131a7874033e40652cb0248bdffd5
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver

 

报错原因:

yml文件太严格了!!!

要在加了 {cipher}的值上加上 '' 单引号!

 

正确配置

#-----------------db------------------
mybatis:
  type-aliases-package: com.book.product.pojo
  mapper-locations: classpath:com/book/product/mapper/*.xml

spring:
  datasource:
    url: jdbc:mysql:///book-product?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
    username: '{cipher}24583ad4b96a662ad323fce2e452a7cd9f7c7d276d17511e3e1226398e6b7e92'
    password: '{cipher}ca62ef4d6b3fec3cbc75aeca077c81c5923131a7874033e40652cb0248bdffd5'
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
posted @ 2019-12-13 15:09  Arebirth  阅读(2432)  评论(0编辑  收藏  举报