Springboot 工具类静态注入
用springboot搭了一个项目,里面要用到一个DictUtils,因为要用到DictMapper,在百度找了一些方法,最后用下面的方法能成功获取到DictMapper
@Component public class DictUtils { @Resource private DictMapper dictMapper1; private static DictMapper dictMapper; @PostConstruct public void init() { this.dictMapper = dictMapper1; } }