String Encryptor custom Bean not found with name ‘jasyptStringEncryptor‘...

项目采用

spring boot 2.6.13

jasypt-spring-boot-starter 3.0.5

apollo-client 1.6.0

自定义jasyptStringEncryptor,服务器上启动死活报找不到bean jasyptStringEncryptor,采用默认的,密文配置项自然解密失败导致服务无法启动。

经过一系列排查是因为apollo和jasypt冲突,导致自定义加解密方法失效的问题,查询配置多个版本验证也无法解决,最终使用以下方式解决。

pom依赖将jasypt-spring-boot-starter 改成jasypt-spring-boot

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

并且在自定义解密上手动添加jasypt启用注解

@EnableEncryptableProperties

配置文件

########################## 配置加密算法 ##################
jasypt:
  encryptor:
    iv-generator-classname: org.jasypt.iv.NoIvGenerator
    password: 你的密钥

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-02 07:00:06       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-02 07:00:06       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-02 07:00:06       87 阅读
  4. Python语言-面向对象

    2024-04-02 07:00:06       96 阅读

热门阅读

  1. C#WPF设置圆角按钮样式

    2024-04-02 07:00:06       34 阅读
  2. ElasticSearch的DSL查询

    2024-04-02 07:00:06       41 阅读
  3. linxu tensorflow-1.13.1 C++动态库编译

    2024-04-02 07:00:06       34 阅读
  4. 介绍 TensorFlow 的基本概念和使用场景

    2024-04-02 07:00:06       31 阅读
  5. 【OpenCV-环境搭建】

    2024-04-02 07:00:06       39 阅读
  6. 【C/C++】C语言实现顺序表

    2024-04-02 07:00:06       33 阅读
  7. 手搓ajax的封装

    2024-04-02 07:00:06       39 阅读
  8. npm常用命令详解

    2024-04-02 07:00:06       39 阅读
  9. js怎样获取到时间戳?

    2024-04-02 07:00:06       36 阅读
  10. 给手机换电池、贴膜:VIVO服务还是非常好的

    2024-04-02 07:00:06       159 阅读