public static void main(final String[] cmdArgs) { try (final AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext()) { ctx.getEnvironment().addActiveProfile(Constants.STANDARD_DATABASE); ctx.register(LHHuntingClubCmdContext.class); ctx.refresh(); ctx.start(); try { ctx.getBean(LiquibaseConfig.class).upgradeDatabase(); ctx.getBean(JobOperator.class).startNextInstance(LHHuntingClubBatchConfig.JOB_NAME); } catch (Exception e) { LOG.error("Job execution has failed with error", e); } } }
public static void main(String[] args) throws Exception { ServerConfigHelper.initLog4j("log4j-shell.xml"); ClassPathXmlApplicationContext ctx = Util.initContext("batch/new-context.xml","batch-file-ac01.xml"); JobLauncher launch = ctx.getBean(JobLauncher.class); JobExplorer epl=ctx.getBean(JobExplorer.class); JobRegistry reg =ctx.getBean(JobRegistry.class); JobOperator jop=ctx.getBean(JobOperator.class); System.out.println(epl.getJobNames()+" "+reg.getJobNames()+" "+jop.toString()); for(String bn: ctx.getBeanFactory().getBeanDefinitionNames()) { System.out.println(bn); } ctx.close(); }
@Bean public JobService jobService(JobOperator batchJobOperator, JobRegistry batchJobRegistry, JobExplorer jobExplorer, JobLauncher jobLauncher, JobRepository jobRepository) throws Exception { return new JobServiceImpl(jobExplorer, batchJobOperator, jobLauncher, batchJobRegistry, jobRepository); }
@Bean @ConditionalOnMissingBean(JobService.class) public JobService jobService(JobOperator batchJobOperator, JobRegistry batchJobRegistry, JobExplorer jobExplorer, JobLauncher jobLauncher, JobRepository jobRepository) throws Exception { return new JobServiceImpl(jobExplorer, batchJobOperator, jobLauncher, batchJobRegistry, jobRepository); }
@Bean @ConditionalOnMissingBean(JobOperator.class) public SimpleJobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher, ListableJobLocator jobRegistry, JobRepository jobRepository) throws Exception { SimpleJobOperator factory = new SimpleJobOperator(); factory.setJobExplorer(jobExplorer); factory.setJobLauncher(jobLauncher); factory.setJobRegistry(jobRegistry); factory.setJobRepository(jobRepository); if (this.jobParametersConverter != null) { factory.setJobParametersConverter(this.jobParametersConverter); } return factory; }
public static void main(String[] args) { try { ServerConfigHelper.initConfig(); ServerConfigHelper.initLog4j("log4j-debug.xml"); ClassPathXmlApplicationContext ctx = Util.initContext("batch/new-context.xml"); JobLauncher launch = ctx.getBean(JobLauncher.class); JobExplorer epl=ctx.getBean(JobExplorer.class); JobRegistry reg =ctx.getBean(JobRegistry.class); JobOperator jop=ctx.getBean(JobOperator.class); ClassPathXmlApplicationContext ctx2 = Util.initContext(false,"batch/job-context.xml","batch-file-prod.xml"); ctx2.setParent(ctx); ctx2.refresh(); Job job = ctx2.getBean(Job.class); JobParametersBuilder build = new JobParametersBuilder(); build.addLong("Id", System.currentTimeMillis()); JobExecution exec= launch.run(job,build.toJobParameters()); System.out.println(reg.getJobNames()); Thread.sleep(Long.MAX_VALUE); } catch (Exception e) { e.printStackTrace(); } }
public JobMonitoringController(JobOperator jobOperator, JobExplorer jobExplorer, RunningExecutionTracker runningExecutionTracker) { super(); this.jobOperator = jobOperator; this.jobExplorer = jobExplorer; this.runningExecutionTracker = runningExecutionTracker; }
public JobOperationsController(JobOperator jobOperator, JobExplorer jobExplorer, JobRegistry jobRegistry, JobRepository jobRepository, JobLauncher jobLauncher, JsrJobOperator jsrJobOperator) { super(); this.jobOperator = jobOperator; this.jobExplorer = jobExplorer; this.jobRegistry = jobRegistry; this.jobRepository = jobRepository; this.jobLauncher = jobLauncher; this.jsrJobOperator = jsrJobOperator; }
@Bean public MBeanExporter mBeanExporter(JobOperator jobOperator) { Map<String, Object> map = new HashMap<>(); map.put("kr.spring.batch:name=jobOperator", jobOperator); MBeanExporter exporter = new MBeanExporter(); exporter.setBeans(map); return exporter; }
/** * EgovBatchRunner 생성자 * JobOperator, JobExplorer, JobRepository를 설정한다. * * @param jobOperator * @param jobExplorer * @param jobRepository */ public EgovBatchRunner(JobOperator jobOperator, JobExplorer jobExplorer, JobRepository jobRepository) { Assert.notNull(jobOperator, "The JobOperator is mandatory"); Assert.notNull(jobExplorer, "The JobExplorer is mandatory"); Assert.notNull(jobRepository, "The JobRepository is mandatory"); this.jobOperator = jobOperator; this.jobExplorer = jobExplorer; this.jobRepository = jobRepository; }
public MyOwnJobService(JobExplorer jobExplorer, JobOperator jobOperator, JobLauncher jobLauncher, JobRegistry jobRegistry, JobRepository jobRepository) { super(jobExplorer, jobOperator, jobLauncher, jobRegistry, jobRepository); }
@Bean public JobService jobService(JobOperator batchJobOperator, JobRegistry batchJobRegistry, JobExplorer jobExplorer, JobLauncher jobLauncher, JobRepository jobRepository) throws Exception { return new MyOwnJobService(jobExplorer, batchJobOperator, jobLauncher, batchJobRegistry, jobRepository); }
public JobOperator jobOperator() { return jobOperator; }
/** * JobOperator를 사용할 수 있도록 가져온다. * * @return JobOperator */ public JobOperator getJobOperator() { return jobOperator; }