添加Jasypt加密依赖项后,Springboot应用程序性能受到影响

问题描述

在引入Jasypt依赖项之前,我的Springboot应用程序(2.3.0)正常运行:

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

然后唯一的更改是将我的application.properties中的纯文本密码替换为ENC(***):

datasource.password=ENC(*************************************)

如何提高性能?过去几毫秒之内加载的应用程序页面现在需要4-5秒的加载时间。

解决方法

我获取了jasypt源代码,并替换了一行以简单地返回false。

这是jasypt源代码中导致缓慢的行: RefreshScopeRefreshedEventListener.java

boolean isAssignable(String className,Object value) {
    try {
        return ClassUtils.isAssignableValue(ClassUtils.forName(className,null),value);
     }...