1 问题描述

在Spring Boot中使用jasypt-spring-boot进行加密,但是提示:

Description:

Failed to bind properties under 'spring.datasource.password' to java.lang.String:

    Reason: Failed to bind properties under 'spring.datasource.password' to java.lang.String

Action:

Update your application's configuration

或提示

Description:

Failed to bind properties under 'spring.datasource.url' to java.lang.String:

    Reason: Failed to bind properties under 'spring.datasource.password' to java.lang.String

Action:

Update your application's configuration

最后的异常是这个:

2 解决办法

查阅了相关issue,发现是3.0.2更改了默认的加密算法,最后的办法是把版本降到2.1.2:

<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.1.2</version>
</dependency>

接着重新加密配置,但是2.1.2不支持使用环境变量作为加密的口令,在IDEA中测试的时候需要在运行配置加上

-Djasypt.encryptor.password=xxxx

部署到Tomcat时添加环境变量:

export JAVA_OPTS="-Djasypt.encryptor.password=xxxx"

最新文章

  1. .NET面试题系列[1] - .NET框架基础知识(1)
  2. JS魔法堂:属性、特性,傻傻分不清楚
  3. CPU MPU MCU SOC SOPC关系及区别
  4. .NET设计模式(11):组合模式(Composite Pattern)(转)
  5. 用IDEA调试Play工程
  6. WTL---WxWidget---MFC 何去何从
  7. ASP.NET MVC Url中带点号出现404错误的解决方案
  8. SSM框架整合,以CRM为例子
  9. deeplearning.ai 神经网络和深度学习 week3 浅层神经网络 听课笔记
  10. js高阶函数应用—函数防抖和节流
  11. python 可迭代对象 迭代器 生成器总结
  12. AJAX里使用的弹窗样式 tanchuang.js tanchuang.css
  13. json2.js 序列化 和反序列化 转
  14. 样条之EHMT插值函数
  15. linux命令(46):程序运行前后台切换
  16. Python mysql-数据库基础知识
  17. 《JavaScript 实战》:实现图片幻滑动展示效果
  18. [android] AndroidManifest.xml -【manifest】
  19. java 问题
  20. jq from表单 取值

热门文章

  1. 用Python实现一个“百度翻译”
  2. halo博客安装教程,一款优秀的java开源博客系统
  3. Python3+PYQT5 实现并打包exe小工具(2)
  4. Java基础语法:注释
  5. linux 安装软件步骤
  6. 关于C++中构造函数的常见疑问
  7. (三)MySQL锁机制 + 事务
  8. Codeforces 682C Alyona and the Tree
  9. 部分rpm包总结描述
  10. Linux下找出吃内存的方法总结