工具类
@Component
public class CacheManageUtils {
public static CacheManageUtils cacheManageUtils;
@Resource
private AreaService areaService; //需要service在spring容器中
@PostConstruct
public void init() {
cacheManageUtils = this;
cacheManageUtils.areaService = this.areaService;
}
//静态方法中使用service方式
public static List<AreaModel> GetAreaCaChe(){
return cacheManageUtils.areaService.getAllAreaList();
}
}