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