添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
失恋的滑板  ·  springmvc配置MappingJack ...·  12 小时前    · 
帅气的弓箭  ·  Jackson·  12 小时前    · 
怕老婆的卤蛋  ·  C# 基本语法 | ·  7 小时前    · 
博学的紫菜  ·  日期选择框 DatePicker - ...·  1 月前    · 
强健的松鼠  ·  风华神女录_第 163 节 ...·  2 月前    · 
酷酷的石榴  ·  2024 US News ...·  5 月前    · 

Example usage for org.springframework.batch.core.repository.support JobRepositoryFactoryBean JobRepositoryFactoryBean

List of usage examples for org.springframework.batch.core.repository.support JobRepositoryFactoryBean JobRepositoryFactoryBean

Introduction

In this page you can find the example usage for org.springframework.batch.core.repository.support JobRepositoryFactoryBean JobRepositoryFactoryBean.

Prototype

JobRepositoryFactoryBean

Source Link

Usage

From source file: com.example.configuration.BatchConfiguration.java

public JobRepository getJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    factory.setDataSource(config.dataSource());
    factory.setTransactionManager(transactionManager);
    factory.setLobHandler(lobHandler());
    factory.setDatabaseType(DatabaseType.fromMetaData(config.dataSource()).name());
    factory.setIsolationLevelForCreate("ISOLATION_DEFAULT");
    factory.afterPropertiesSet();//ww  w .j a v a2  s .com
    return (JobRepository) factory.getObject();

From source file: org.my.spring.batch.java.config.demo.configuration.BatchConfiguration.java

@Override
public JobRepository getJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    factory.setDataSource(getDataSource());
    factory.setTransactionManager(getTransactionManager());
    factory.afterPropertiesSet();/*  ww w  .j a  v  a2 s.co m*/
    return (JobRepository) factory.getObject();

From source file: com.apress.prospringintegration.springbatch.integration.BatchConfiguration.java

@Bean
public JobRepositoryFactoryBean jobRepository() {
    JobRepositoryFactoryBean jobRepository = new JobRepositoryFactoryBean();
    jobRepository.setDataSource(dataSource);
    jobRepository.setTransactionManager(transactionManager());
    return jobRepository;

From source file: uk.ac.kcl.batch.BatchConfigurer.java

@Override
protected JobRepository createJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    factory.setDataSource(jobRepositoryDataSource);
    factory.setTransactionManager(getTransactionManager());
    //to avoid deadlocks on the Job repo in SQL SERVER 2008
    factory.setIsolationLevelForCreate("ISOLATION_REPEATABLE_READ");
    factory.afterPropertiesSet();// w  w w  .ja  v  a  2 s. c  om
    return factory.getObject();

From source file: de.codecentric.batch.configuration.TaskExecutorBatchConfigurer.java

protected JobRepository createJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    factory.setDataSource(dataSource);//w w  w . ja  va 2  s  .  c om
    factory.setTransactionManager(transactionManager);
    String isolationLevelForCreate = env.getProperty("batch.repository.isolationlevelforcreate");
    if (isolationLevelForCreate != null) {
        factory.setIsolationLevelForCreate(isolationLevelForCreate);
    String tablePrefix = env.getProperty("batch.repository.tableprefix");
    if (tablePrefix != null) {
        factory.setTablePrefix(tablePrefix);
    factory.afterPropertiesSet();
    return factory.getObject();

From source file: com.springsource.html5expense.config.BatchConfig.java

@Bean
public JobRepositoryFactoryBean jobRepository() throws Exception {
    JobRepositoryFactoryBean bean = new JobRepositoryFactoryBean();
    bean.setTransactionManager(new DataSourceTransactionManager(dataSourceConfig.dataSource()));
    bean.setDataSource(dataSourceConfig.dataSource());
    return bean;//from w  w w. j av  a  2 s  .com

From source file: io.getlime.push.configuration.BatchSendingConfiguration.java

private JobRepository createJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    factory.setDataSource(dataSource);//from  www . j  av a  2  s . c  om
    factory.setTransactionManager(transactionManager);
    factory.setIsolationLevelForCreate("ISOLATION_DEFAULT");
    factory.afterPropertiesSet();
    return factory.getObject();

From source file: org.cloudfoundry.workers.stocks.batch.BatchConfiguration.java

/**
 * Stores information about the {@link Job jobs} into a backend store (like
 * a {@link DataSource})//w w  w.ja v  a  2  s .  c o m
 * @throws Exception
@Bean
public JobRepository jobRepository() throws Exception {
    JobRepositoryFactoryBean jobRepositoryFactoryBean = new JobRepositoryFactoryBean();
    jobRepositoryFactoryBean.setDataSource(dsConfig.dataSource());
    jobRepositoryFactoryBean.setTransactionManager(this.transactionManager());
    jobRepositoryFactoryBean.afterPropertiesSet();
    return (JobRepository) jobRepositoryFactoryBean.getObject();

From source file: org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer.java

protected JobRepository createJobRepository() throws Exception {
    JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
    factory.setDataSource(dataSource);/*  www .ja va 2 s  . com*/
    factory.setTransactionManager(transactionManager);
    factory.afterPropertiesSet();
    return factory.getObject();

From source file: org.springframework.batch.core.step.item.FaultTolerantStepFactoryBeanUnexpectedRollbackTests.java

@Test
@Ignore //FIXME//from  w  ww  .ja  v  a 2s  . c  o  m
public void testTransactionException() throws Exception {
    final SkipWriterStub<String> writer = new SkipWriterStub<String>();
    FaultTolerantStepFactoryBean<String, String> factory = new FaultTolerantStepFactoryBean<String, String>();
    factory.setItemWriter(writer);
    @SuppressWarnings("serial")
    DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(dataSource) {
        private boolean failed = false;
        @Override
        protected void doCommit(DefaultTransactionStatus status) throws TransactionException {
            if (writer.getWritten().isEmpty() || failed || !isExistingTransaction(status.getTransaction())) {
                super.doCommit(status);
                return;
            failed = true;
            status.setRollbackOnly();
            super.doRollback(status);
            throw new UnexpectedRollbackException("Planned");
    factory.setBeanName("stepName");
    factory.setTransactionManager(transactionManager);
    factory.setCommitInterval(2);
    ItemReader<String> reader = new ListItemReader<String>(Arrays.asList("1", "2"));
    factory.setItemReader(reader);
    JobRepositoryFactoryBean repositoryFactory = new JobRepositoryFactoryBean();
    repositoryFactory.setDataSource(dataSource);
    repositoryFactory.setTransactionManager(transactionManager);
    repositoryFactory.afterPropertiesSet();
    JobRepository repository = repositoryFactory.getObject();
    factory.setJobRepository(repository);
    JobExecution jobExecution = repository.createJobExecution("job", new JobParameters());
    StepExecution stepExecution = jobExecution.createStepExecution(factory.getName());
    repository.add(stepExecution);
    Step step = factory.getObject();
    step.execute(stepExecution);
    assertEquals(BatchStatus.FAILED, stepExecution.getStatus());