标签:vat mapper bsp ati wired private ring util auto
一般在spring中,给static变量加上@Autowired注解的时候会报空指针异常错误.
解决:
这个就不多说了.
@Component public class StructUtil { private static AttendanceMapper attendanceMapper; @Autowired public void setAttendanceMapper(AttendanceMapper attendanceMapper) { StructUtil.attendanceMapper = attendanceMapper; } }
加上注解@Component,然后在静态变量的set方法上方加上@Autowired注解,注意:set方法不能为static类型.
标签:vat mapper bsp ati wired private ring util auto
原文地址:https://www.cnblogs.com/lishuaiqi/p/10416609.html