1、Spring 注入的原理:
关于对spring注入bean的顺序,以及spring如何保证事先加载依赖bean的问题_springboot注入顺序-CSDN博客
2、出现问题的原因
?
3、解决
@Component
public class MakeCopyTaskListener implements TaskListener {
private static SysUserRoleMapper sysUserRoleMapper;
@Resource
public void setSysUserRoleMapper(SysUserRoleMapper sysUserRoleMapper) {
MakeCopyTaskListener.sysUserRoleMapper = sysUserRoleMapper;
}
private static IMakeCopyService makeCopyService;
@Autowired
public void setMakeCopyService(IMakeCopyService makeCopyService) {
MakeCopyTaskListener.makeCopyService = makeCopyService;
}
}