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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM