com.myb.common.util.jasyptUtil Maven / Gradle / Ivy
package com.myb.common.util;
import org.jasypt.encryption.StringEncryptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
/**
* @Author meiyubin
* @Date 2023/12/1
* @DESC
*/
@Component
public class jasyptUtil {
@Autowired
private StringEncryptor stringEncryptor;
public String encrypt(String str) {
if (!StringUtils.isEmpty(str)){
return stringEncryptor.encrypt(str);}
return "";
}
}