Tabnine Logo
JsrXmlApplicationContext.getBean
Code IndexAdd Tabnine to your IDE (free)

How to use
getBean
method
in
org.springframework.batch.core.jsr.configuration.xml.JsrXmlApplicationContext

Best Java code snippets using org.springframework.batch.core.jsr.configuration.xml.JsrXmlApplicationContext.getBean (Showing top 13 results out of 315)

origin: spring-projects/spring-batch

  @Override
  public void run() {
    JsrJobContextFactoryBean factoryBean = null;
    try {
      factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
      factoryBean.setJobExecution(jobExecution);
      final Job job = batchContext.getBean(Job.class);
      semaphore.release();
      // Initialization of the JobExecution for job level dependencies
      jobRegistry.register(job, jobExecution);
      job.execute(jobExecution);
      jobRegistry.remove(jobExecution);
    }
    catch (Exception e) {
      exceptionHolder.add(e);
    } finally {
      if(factoryBean != null) {
        factoryBean.close();
      }
      batchContext.close();
      if(semaphore.availablePermits() == 0) {
        semaphore.release();
      }
    }
  }
});
origin: codecentric/spring-boot-starter-batch-web

JsrJobContextFactoryBean factoryBean = null;
try {
  factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
  factoryBean.setJobExecution(jobExecution);
  final AbstractJob job = batchContext.getBean(AbstractJob.class);
  addListenerToJobService.addListenerToJob(job);
  semaphore.release();
origin: spring-projects/spring-batch

  @Override
  public void run() {
    JsrJobContextFactoryBean factoryBean = null;
    try {
      factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
      factoryBean.setJobExecution(jobExecution);
      final Job job = batchContext.getBean(Job.class);
      if(!job.isRestartable()) {
        throw new JobRestartException("Job " + jobName + " is not restartable");
      }
      semaphore.release();
      // Initialization of the JobExecution for job level dependencies
      jobRegistry.register(job, jobExecution);
      job.execute(jobExecution);
      jobRegistry.remove(jobExecution);
    }
    catch (Exception e) {
      exceptionHolder.add(e);
    } finally {
      if(factoryBean != null) {
        factoryBean.close();
      }
      batchContext.close();
      if(semaphore.availablePermits() == 0) {
        semaphore.release();
      }
    }
  }
});
origin: de.codecentric/batch-web-spring-boot-autoconfigure

JsrJobContextFactoryBean factoryBean = null;
try {
  factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
  factoryBean.setJobExecution(jobExecution);
  final AbstractJob job = batchContext.getBean(AbstractJob.class);
  addListenerToJobService.addListenerToJob(job);
  semaphore.release();
origin: spring-projects/spring-batch

  @Test
  @SuppressWarnings({"resource", "rawtypes"})
  public void testOverrideBeansLast() {
    JsrXmlApplicationContext context = new JsrXmlApplicationContext();
    Resource overrideXml = new ClassPathResource("/org/springframework/batch/core/jsr/configuration/xml/override_batch.xml");
    Resource batchXml = new ClassPathResource("/org/springframework/batch/core/jsr/configuration/xml/batch.xml");

    context.setValidating(false);
    context.load(batchXml, overrideXml);
    context.refresh();

    ItemProcessor processor = (ItemProcessor) context.getBean("itemProcessor");

    assertNotNull(processor);
    assertTrue(processor instanceof DummyItemProcessor);
    context.close();
  }
}
origin: spring-projects/spring-batch

@Test
@SuppressWarnings("unchecked")
public void testOverrideBeansFirst() throws Exception {
  JsrXmlApplicationContext context = new JsrXmlApplicationContext();
  Resource overrideXml = new ClassPathResource("/org/springframework/batch/core/jsr/configuration/xml/override_batch.xml");
  Resource batchXml = new ClassPathResource("/org/springframework/batch/core/jsr/configuration/xml/batch.xml");
  context.setValidating(false);
  context.load(overrideXml, batchXml);
  context.refresh();
  ItemProcessor<String, String> itemProcessor = context.getBean("itemProcessor", ItemProcessor.class);
  assertNotNull(itemProcessor);
  StepSynchronizationManager.register(new StepExecution("step1", new JobExecution(5l)));
  assertEquals("Test", itemProcessor.process("Test"));
  StepSynchronizationManager.close();
  context.close();
}
origin: spring-projects/spring-batch

@Test
@SuppressWarnings("unchecked")
public void testRoseyScenario() throws Exception {
  JsrXmlApplicationContext context = new JsrXmlApplicationContext();
  Resource batchXml = new ClassPathResource("/org/springframework/batch/core/jsr/configuration/xml/batch.xml");
  context.setValidating(false);
  context.load(batchXml);
  GenericBeanDefinition stepScope = new GenericBeanDefinition();
  stepScope.setBeanClass(StepScope.class);
  context.registerBeanDefinition("stepScope", stepScope);
  GenericBeanDefinition bd = new GenericBeanDefinition();
  bd.setBeanClass(AutowiredAnnotationBeanPostProcessor.class);
  context.registerBeanDefinition("postProcessor", bd);
  context.refresh();
  ItemProcessor<String, String> itemProcessor = context.getBean(ItemProcessor.class);
  assertNotNull(itemProcessor);
  StepSynchronizationManager.register(new StepExecution("step1", new JobExecution(5l)));
  assertEquals("Test", itemProcessor.process("Test"));
  StepSynchronizationManager.close();
  context.close();
}
origin: org.springframework.batch/spring-batch-core

  @Override
  public void run() {
    JsrJobContextFactoryBean factoryBean = null;
    try {
      factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
      factoryBean.setJobExecution(jobExecution);
      final Job job = batchContext.getBean(Job.class);
      semaphore.release();
      // Initialization of the JobExecution for job level dependencies
      jobRegistry.register(job, jobExecution);
      job.execute(jobExecution);
      jobRegistry.remove(jobExecution);
    }
    catch (Exception e) {
      exceptionHolder.add(e);
    } finally {
      if(factoryBean != null) {
        factoryBean.close();
      }
      batchContext.close();
      if(semaphore.availablePermits() == 0) {
        semaphore.release();
      }
    }
  }
});
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

  @Override
  public void run() {
    JsrJobContextFactoryBean factoryBean = null;
    try {
      factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
      factoryBean.setJobExecution(jobExecution);
      final Job job = batchContext.getBean(Job.class);
      semaphore.release();
      // Initialization of the JobExecution for job level dependencies
      jobRegistry.register(job, jobExecution);
      job.execute(jobExecution);
      jobRegistry.remove(jobExecution);
    }
    catch (Exception e) {
      exceptionHolder.add(e);
    } finally {
      if(factoryBean != null) {
        factoryBean.close();
      }
      batchContext.close();
      if(semaphore.availablePermits() == 0) {
        semaphore.release();
      }
    }
  }
});
origin: apache/servicemix-bundles

  @Override
  public void run() {
    JsrJobContextFactoryBean factoryBean = null;
    try {
      factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
      factoryBean.setJobExecution(jobExecution);
      final Job job = batchContext.getBean(Job.class);
      semaphore.release();
      // Initialization of the JobExecution for job level dependencies
      jobRegistry.register(job, jobExecution);
      job.execute(jobExecution);
      jobRegistry.remove(jobExecution);
    }
    catch (Exception e) {
      exceptionHolder.add(e);
    } finally {
      if(factoryBean != null) {
        factoryBean.close();
      }
      batchContext.close();
      if(semaphore.availablePermits() == 0) {
        semaphore.release();
      }
    }
  }
});
origin: apache/servicemix-bundles

  @Override
  public void run() {
    JsrJobContextFactoryBean factoryBean = null;
    try {
      factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
      factoryBean.setJobExecution(jobExecution);
      final Job job = batchContext.getBean(Job.class);
      if(!job.isRestartable()) {
        throw new JobRestartException("Job " + jobName + " is not restartable");
      }
      semaphore.release();
      // Initialization of the JobExecution for job level dependencies
      jobRegistry.register(job, jobExecution);
      job.execute(jobExecution);
      jobRegistry.remove(jobExecution);
    }
    catch (Exception e) {
      exceptionHolder.add(e);
    } finally {
      if(factoryBean != null) {
        factoryBean.close();
      }
      batchContext.close();
      if(semaphore.availablePermits() == 0) {
        semaphore.release();
      }
    }
  }
});
origin: org.springframework.batch/spring-batch-core

  @Override
  public void run() {
    JsrJobContextFactoryBean factoryBean = null;
    try {
      factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
      factoryBean.setJobExecution(jobExecution);
      final Job job = batchContext.getBean(Job.class);
      if(!job.isRestartable()) {
        throw new JobRestartException("Job " + jobName + " is not restartable");
      }
      semaphore.release();
      // Initialization of the JobExecution for job level dependencies
      jobRegistry.register(job, jobExecution);
      job.execute(jobExecution);
      jobRegistry.remove(jobExecution);
    }
    catch (Exception e) {
      exceptionHolder.add(e);
    } finally {
      if(factoryBean != null) {
        factoryBean.close();
      }
      batchContext.close();
      if(semaphore.availablePermits() == 0) {
        semaphore.release();
      }
    }
  }
});
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

  @Override
  public void run() {
    JsrJobContextFactoryBean factoryBean = null;
    try {
      factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
      factoryBean.setJobExecution(jobExecution);
      final Job job = batchContext.getBean(Job.class);
      if(!job.isRestartable()) {
        throw new JobRestartException("Job " + jobName + " is not restartable");
      }
      semaphore.release();
      // Initialization of the JobExecution for job level dependencies
      jobRegistry.register(job, jobExecution);
      job.execute(jobExecution);
      jobRegistry.remove(jobExecution);
    }
    catch (Exception e) {
      exceptionHolder.add(e);
    } finally {
      if(factoryBean != null) {
        factoryBean.close();
      }
      batchContext.close();
      if(semaphore.availablePermits() == 0) {
        semaphore.release();
      }
    }
  }
});
org.springframework.batch.core.jsr.configuration.xmlJsrXmlApplicationContextgetBean

Popular methods of JsrXmlApplicationContext

  • <init>
    Create a new context instance using the provided Properties representing job parameters when pre-pr
  • close
  • load
    Load bean definitions from the given XML resources.
  • refresh
  • registerBeanDefinition
  • setValidating
    Set whether to use XML validation. Default is true.
  • getBeanNamesForType
  • isActive
  • setParent
  • getEnvironment
  • storeJobParameters
  • getBeanFactory
  • storeJobParameters,
  • getBeanFactory,
  • containsBeanDefinition,
  • getBeanDefinition

Popular in Java

  • Creating JSON documents from java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • runOnUiThread (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Permission (java.security)
    Legacy security code; do not use.
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • JButton (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now