NutzCN Logo
问答 nuztboot 初始化方法不执行?我是按照文档写的
发布于 1473天前 作者 小苍蝇 1505 次浏览 复制 上一个帖子 下一个帖子
标签:
@Scheduled(cron = "0 0 * * * ?")
@IocBean(create="init",args = {"refer:dao"})
public class AllGetEmergencyOptionListJob extends EntityRepositoryServiceImpl<EmergencyOption> implements Job {

    //这个初始化无法执行
    public void init(){
    	System.out.println("############");
        List<Map> list = findAll();
        for (int i = 0; i < list.size(); i++) {
            EmergencyOption option = new EmergencyOption();
            option.setCode1(0L);
            option.setOptionId((String) list.get(i).get("id"));
            option.setCode((String) list.get(i).get("code"));
            option.setFaultCode((String) list.get(i).get("faultCode"));
            option.setDescription1((String) list.get(i).get("parts"));
            option.setDescription2((String) list.get(i).get("type"));
            option.setLiftCategory((String) list.get(i).get("managerCode"));
            option.setFraction(40);
            emergencyOptionServiceI.saveOrUpdateByOptionId(option);
        }
    }

  @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        List<Map> list = findAll();
        for (int i = 0; i < list.size(); i++) {
            EmergencyOption option = new EmergencyOption();
            option.setCode1(0L);
            option.setOptionId((String) list.get(i).get("id"));
            option.setCode((String) list.get(i).get("code"));
            option.setFaultCode((String) list.get(i).get("faultCode"));
            option.setDescription1((String) list.get(i).get("parts"));
            option.setDescription2((String) list.get(i).get("type"));
            option.setLiftCategory((String) list.get(i).get("managerCode"));
            option.setFraction(40);
            emergencyOptionServiceI.saveOrUpdateByOptionId(option);
        }
    }

}
1 回复

看看日志,大概率不是从ioc取出job对象

添加回复
请先登陆
回到顶部