本文整理汇总了Java中org.springframework.batch.core.configuration.JobRegistry类的典型用法代码示例。如果您正苦于以下问题:Java JobRegistry类的具体用法?Java JobRegistry怎么用?Java JobRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JobRegistry类属于org.springframework.batch.core.configuration包,在下文中一共展示了JobRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
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();
}
示例2: main
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
public static void main(String[] args) throws JobExecutionAlreadyRunningException, JobRestartException,
JobInstanceAlreadyCompleteException, JobParametersInvalidException, DuplicateJobException {
ConfigurableApplicationContext ctx = SpringApplication.run(Application.class, args);
Job simpleJob = ctx.getBean("simpleJob", Job.class);
JobRegistry jobRegistry = ctx.getBean("jobRegistry", JobRegistry.class);
jobRegistry.register(new ReferenceJobFactory(simpleJob));
//JobRepository jobRepository = ctx.getBean("jobRepository", JobRepository.class);
//JobInstance jobInstance = jobRepository.createJobInstance("simpleJob", new JobParameters());
// JobParameters jobParameters = ctx.getBean("basicParameters", JobParameters.class);
//
//JobRegistry jobRegistry = ctx.getBean("mapJobRegistry", JobRegistry.class);
// jobRegistry.register();
// jobLauncher.run(job, jobParameters);
}
示例3: JobServiceImpl
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
public JobServiceImpl(JobExplorer jobExplorer, JobOperator jobOperator, JobLauncher jobLauncher, JobRegistry jobRegistry,
JobRepository jobRepository) {
this.jobExplorer = jobExplorer;
this.jobOperator = jobOperator;
this.jobLauncher = jobLauncher;
this.jobRegistry = jobRegistry;
this.jobRepository = jobRepository;
}
示例4: jobService
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
@Bean
public JobService jobService(JobOperator batchJobOperator,
JobRegistry batchJobRegistry,
JobExplorer jobExplorer,
JobLauncher jobLauncher,
JobRepository jobRepository) throws Exception {
return new JobServiceImpl(jobExplorer, batchJobOperator, jobLauncher, batchJobRegistry, jobRepository);
}
示例5: jobService
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
@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);
}
示例6: jobRegistrar
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
@Bean
public AutomaticJobRegistrar jobRegistrar(JobRegistry jobRegistry) throws Exception {
AutomaticJobRegistrar registrar = new AutomaticJobRegistrar();
registrar.setJobLoader(new DefaultJobLoader(jobRegistry));
for (ApplicationContextFactory factory : applicationContext.getBeansOfType(ApplicationContextFactory.class).values()) {
registrar.addApplicationContextFactory(factory);
}
return registrar;
}
示例7: testServletConfiguration
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
@Test
public void testServletConfiguration() throws Exception {
ClassPathXmlApplicationContext parent = new ClassPathXmlApplicationContext(
"classpath:/org/springframework/batch/admin/web/resources/webapp-config.xml");
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
new String[] { "classpath:/org/springframework/batch/admin/web/resources/servlet-config.xml" }, parent);
assertTrue(context.containsBean("jobRepository"));
String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context.getBeanFactory(),
JobController.class);
assertEquals(1, beanNames.length);
Job job = context.getBean(JobRegistry.class).getJob("job1");
final JobExecution jobExecution = parent.getBean(JobLauncher.class).run(job,
new JobParametersBuilder().addString("fail", "false").toJobParameters());
new DirectPoller<BatchStatus>(100).poll(new Callable<BatchStatus>() {
public BatchStatus call() throws Exception {
BatchStatus status = jobExecution.getStatus();
if (status.isLessThan(BatchStatus.STOPPED) && status!=BatchStatus.COMPLETED) {
return null;
}
return status;
}
}).get(2000, TimeUnit.MILLISECONDS);
context.close();
parent.close();
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
}
示例8: main
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
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();
}
}
示例9: BatchController
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
public BatchController(final JobRegistry jobRegistry, final JobExplorer jobExplorer, final BatchOperator batchOperator,
final JobParameterInfoRegistry parameterInfos) {
this.jobRegistry = jobRegistry;
this.jobExplorer = jobExplorer;
this.batchOperator = batchOperator;
this.parameterInfos = parameterInfos;
}
示例10: jobRegistry
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
@Bean
public JobRegistry jobRegistry() {
return new MapJobRegistry() {
@Override
public Set<String> getJobNames() {
return new TreeSet<>(super.getJobNames());
}
};
}
示例11: JobOperationsController
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
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;
}
示例12: MyOwnJobService
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
public MyOwnJobService(JobExplorer jobExplorer, JobOperator jobOperator, JobLauncher jobLauncher, JobRegistry jobRegistry, JobRepository jobRepository) {
super(jobExplorer, jobOperator, jobLauncher, jobRegistry, jobRepository);
}
示例13: jobService
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
@Bean
public JobService jobService(JobOperator batchJobOperator, JobRegistry batchJobRegistry, JobExplorer jobExplorer, JobLauncher jobLauncher, JobRepository jobRepository) throws Exception {
return new MyOwnJobService(jobExplorer, batchJobOperator, jobLauncher, batchJobRegistry, jobRepository);
}
示例14: jobRegistry
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
@Bean
public JobRegistry jobRegistry() {
return new MapJobRegistry();
}
示例15: getJobRegistry
import org.springframework.batch.core.configuration.JobRegistry; //导入依赖的package包/类
public JobRegistry getJobRegistry() {
return jobRegistry;
}