-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
我自定义了个Encryptor,且使用了Spring容器的注入
@Component
public class Encryptor implements IEncryptor {
@Autowired
private PooledPBEStringEncryptor encryptor;
@Autowired
private IUserLogService userLogService;
@Override
public String encrypt(Object o, String s) throws Exception {
userLogService.save(new UserLog());
return encryptor.encrypt(o.toString());
}
@Override
public String decrypt(Object o, String s) throws Exception {
userLogService.save(new UserLog());
return encryptor.decrypt(o.toString());
}
}直接使用了newInstance(),所以不在spring管理里。
是不是把这个defaultEncryptor字段的类型直接改成IEncryptor会比较好?

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
