自定义注解策略类,加密类注入不了
voroq opened this issue · 1 comments
voroq commented
请问,这种自定义策略类,想用StringEncryptor ,该怎么注入呢?
`
public class CustomPasswordStrategy implements IStrategy {
@Autowired
private StringEncryptor stringEncryptor;
@Override
public Object des(Object original, IContext context) {
String encryptStr = stringEncryptor.decrypt(ObjectUtil.objectToString(original));
return encryptStr;
}
}
`
houbb commented
暂时未实现成与 spring 强耦合,后续可能会考虑整合。
spring 的注入,本质上可以使用构造器,set 方法替代。
对于有数据库依赖的 bean 可以使用 spring 工具类获取 bean 来实现。
发自我的iPhone
…------------------ 原始邮件 ------------------
发件人: voroq ***@***.***>
发送时间: 2022年1月18日 11:37
收件人: houbb/sensitive ***@***.***>
抄送: Subscribed ***@***.***>
主题: Re: [houbb/sensitive] 自定义注解策略类,加密类注入不了 (Issue #15)
请问,这种自定义策略类,想用StringEncryptor ,该怎么注入呢?
`public class CustomPasswordStrategy implements IStrategy {
@Autowired private StringEncryptor stringEncryptor; @OverRide public Object des(Object original, IContext context) { String encryptStr = stringEncryptor.decrypt(ObjectUtil.objectToString(original)); return encryptStr; }
}`
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>