不能在静态方法中调用非静态方法
解决方案:
在类上添加@Component注解,让Spring管理起来
@Component
public class Model {
@Autowired
private DesigService designService;
private static Model model;
@PostConstruct
public void init() {
model= this;
model.designService = this.designService;
}
public static void merger() {
model.designService.xxx();
}
}