静态类使用@Resource注解注入
工作中需要,简单记录一下
@Component
public class AccountUtil {
private static AccountIdDao accountIdDao;
@Resource
private AccountIdDao accountDao;
@PostConstruct
public void init(){
accountIdDao = accountDao;
}
public static List<AccountIdInfoPO> getAccount(String channel) {
//获取用户列表
QueryWrapper<AccountIdInfoPO> query = new QueryWrapper<>();
query.eq("channel", channel);
return accountIdDao.selectList(query);
}
}