by BehindJava

What is Execution context class in Java

Home » java » What is Execution context class in Java

In this tutorial, we are going to learn about Execution context in java i.e., Top level of your application creates a class called a “execution context class” to house all the items that might be needed. The ExecutionContext is persistent in Spring Batch, useful if you need to restart a batch run. A set of key-value pairs called an ExecutionContext contains data that is specific to StepExecution or JobExecution.

  • The top level of your application creates a class called a “execution context class” to house all the items that might be needed, such as the Transaction object.
  • This method of avoiding global variables is packaged.
  • Some people think that even this is a little skeezy because you have to send the context to A, B, and C even though they wouldn’t otherwise require it if top called A, B, C, D, and needed the top level.
  • A, B, and C are not reusable in a programme that doesn’t use this context, therefore it encourages binding where it wouldn’t be necessary. However, it’s a completely viable alternative to the unending population growth of singletons and other untidy things, as well as the hidden world state.