fix 修复 获取 SensitiveService 空问题 增加空兼容

This commit is contained in:
疯狂的狮子li 2022-06-29 12:43:32 +08:00
parent 181eaefea8
commit ea3d66fda3

View File

@ -1,5 +1,6 @@
package com.ruoyi.common.jackson;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.JsonMappingException;
@ -26,7 +27,7 @@ public class SensitiveJsonSerializer extends JsonSerializer<String> implements C
@Override
public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
SensitiveService sensitiveService = SpringUtils.getBean(SensitiveService.class);
if (sensitiveService.isSensitive()) {
if (ObjectUtil.isNotNull(sensitiveService) && sensitiveService.isSensitive()) {
gen.writeString(strategy.desensitizer().apply(value));
} else {
gen.writeString(value);