直接附代码:
@Component
public class BszxJob implements BaseJob {
private static BszxJob bszxbJob;
private static final Logger logger = LoggerFactory.getLogger(BszxJob.class);
@Autowired
private BSZXServiceCilent bSZXServiceCilent;
public void execute(JobExecutionContext context) {
logger.info("Hello Job执行开始时间: " + new Date());
bszxbJob.bSZXServiceCilent.updateBsFileUploadResultTsak();
logger.info("Hello Job执行结束时间: " + new Date());
}
@PostConstruct
public void init() {
bszxbJob = this;
bszxbJob.bSZXServiceCilent = this.bSZXServiceCilent;
}
/**
* 这是最关键的
*/
@PostConstruct
public void init() {
bszxbJob = this;
bszxbJob.bSZXServiceCilent = this.bSZXServiceCilent;
}