Top 100+ Spring Batch Interview Questions And Answers
Question 1. Explain Spring Batch Framework.
Answer :
Spring Batch body paintings, a collaborative attempt from Accenture and SpringSource, is a lightweight, complete framework that helps the improvement of batch programs that helps the day after day activities of business enterprise systems. Batch utility or processing refers to computerized offline systems that plays bulk records processing, periodic updates and delegated processing.
Examples consist of loading csv record data to database, procedure feed record once received and push every day transactions to the upstream or downstream structures.
Question 2. List Out Some Of The Practical Usage Scenario Of Spring Batch Framework?
Answer :
Reading massive number of information from a database, document, queue or some other medium, manner it and keep the processed records into medium, as an instance, database.
Concurrent and hugely parallel processing.
Staged, corporation message-pushed processing.
Sequential processing of structured steps.
Whole-batch transaction.
Scheduled and repeated processing.
J2EE Interview Questions
Question three. Technical Advantages Of Using Spring Batch Framework From A Developer Perspective?
Answer :
Batch framework leverages Spring programming version thus allows builders to concentrate on the commercial enterprise logic or the business process and framework allows the infrastructure.
Clear separation of worries between the infrastructure, the batch execution surroundings, the batch application and the unique steps/proceses inside a batch software.
Provides not unusual situation based totally, center execution offerings as interfaces that the packages can implement and in addition to that framework gives its default implementation that the developers ought to use or in part override based on their business good judgment.
Easily configurable and extendable offerings throughout unique layers.
Provides a simple deployment version built the use of Maven.
Question 4. Explain The Spring Batch Framework Architecture?
Answer :
Spring Batch show off a layered structure and it comprises of 3 most important excessive level components:
Application, Core and Infrastructure.
The utility layer includes all the batch process configurations, custom codes for business common sense and task meta records evolved by way of Application developers.
The Batch Core has the middle runtime lessons essential to release and manage any batch activity. Some of the middle runtime training consist of JobLauncher, Job, and Step implementations.
The infrastructure consists of API for not unusual readers and writers, and services for retrying on failure, repeat jobs and so forth. The infrastructure layer are used each with the aid of utility developers(ItemReader and ItemWriter) and the middle framework itself for controlling the batch activity along with Retry, repeat. Thus Batch Core and Application layers are constructed on pinnacle of Infrastructure layer.
J2EE Tutorial
Question 5. How Do You Categorize Batch Applications Based On Input Source In Spring Batch?
Answer :
Database-driven programs are driven by means of rows or values acquired from the database.
File-pushed applications are pushed with the aid of facts or values retrieved from a report.
Message-pushed programs are pushed by messages retrieved from a message queue.
Hibernate Interview Questions
Question 6. What Are The Typical Processing Strategies In Spring Batch?
Answer :
Normal processing throughout offline.
Concurrent batch or online processing.
Parallel processing of many special batch or jobs on the same time.
Partitioning (processing of many times of the same task at the identical time).
Question 7. How Do I Start A Spring Batch Job?
Answer :
A Job Launcher can be used to execute a Spring Batch Job. Also a batch task can be launched/scheduled using an internet field as nicely.
Execution of a activity is termed as Job Instance. Each Job Instance is provided with an execution identity which may be used to restart the process if required.
Job may be configured with parameters that is surpassed to it from the Job Launcher.
Hibernate Tutorial MVC Framework Interview Questions
Question eight. What Are The Important Features Of Spring Batch?
Answer :
Restorability: Restart a batch application from in which it failed.
Different Readers and Writers : Provides extraordinary aid to study from textual content files, csv, JMS, JDBC, Hibernate, iBatis and many others. It can write to JMS, JDBC, Hibernate, documents and many greater.
Chunk Processing : If we've 1 Million records to technique, these can be processed in configurable chunks (one thousand at a time or 10000 at a time).
Easy to put into effect proper transaction control even when the use of bite processing.
Easy to enforce parallel processing. With simple configuration, distinct steps can be run in parallel.
Question 9. Explain Normal Processing Strategy In Spring Batch Framework?
Answer :
Normal processing refers back to the batch procedures that runs in a separate batch window, the statistics being up to date is not required by online users or other batch procedures, in which concurrency might not be a difficulty and a unmarried commit may be completed at the end of the batch run.
Single dedicate factor can be a situation in phrases of scaiability and extent of records it can take care of, it's miles always an awesome practice to have restart restoration options .
Framework7 Interview Questions
Question 10. Explain Concurrent Batch On-line Processing In Spring Batch Framework?
Answer :
Concurrent/online batch processing refers to the batch technique that handles data being concurrently used/updated by online users so the information can not be locked in database or report as the on line customers will need it. Also the records updates must be commited regularly on the stop of few transactions to limit the part of information that is unavailable to other tactics and the elapsed time the statistics is unavailable.
MVC Framework Tutorial
Question 11. Explain Parallel Processing In Spring Batch Framework?
Answer :
Parallel processing allows a couple of batch runs jobs to run in parallel to reduce the full elapsed batch processing time. Parallel processing is less difficult so long as the identical file or database desk isn't shared the various procedures in any other case the strategies have to process partitioned records.
Another approach might be using a manipulate table for retaining interdependencies and to tune every shared aid in use via any method or no longer.
Other key problems in parallel processing consist of load balancing and the supply of fashionable device assets consisting of documents, database buffer swimming pools and so forth. Also be aware that the control desk itself can without difficulty grow to be a vital useful resource.
Maven Interview Questions
Question 12. Explain Partitioning In Spring Batch Framework?
Answer :
Partitioning faciliates a couple of large batch applications to run simultaneously that decrease the elapsed time required to process long batch jobs. Processes which may be efficiently partitioned are those where the input document may be split and/or the principle database tables partitioned to permit the utility to run towards different sets of statistics.
Processes which might be partitioned have to be designed to handiest manner their assigned records set.
J2EE Interview Questions
Question thirteen. What Is Tasklet In Spring Batch Framework?
Answer :
The Tasklet is an interface which performs any unmarried venture such as setup aid, going for walks a sq. Update, cleaning up resources and so forth.
Framework7 Tutorial
Question 14. How Do I Configure A Job In Spring Batch Framework?
Answer :
A Job in Spring Batch includes a sequence of 1 or more Steps. Each Step can be configured with the list of parameters/characteristic required to execute every step.
Next : next step to execute
tasklet: assignment or bite to execute. A bite can be configured with a Item Reader, Item Processor and Item Writer.
Decision : Decide which steps need to completed.
Question 15. What Are Spring Batch Metadata Schema?
Answer :
The Spring Batch Meta-Data tables are used to persist batch area objects including JobInstance, JobExecution, JobParameters, and StepExecution for internally managing the Batch Jobs.
The JobRepository is accountable for saving and storing each Java item into its accurate desk
JUnit Interview Questions
Question 16. Can We Create A Spring Batch With No Step?
Answer :
No. There need to exists at the least one step or glide or break up configuration inside a Spring Batch job.
Maven Tutorial
Question 17. What Are The Different Bean Scope In Spring Batch three.0?
Answer :
Step scope- there may be most effective one example of one of these bean in line with executing step.
<bean id="..." class="..." scope="step">
Job scope- there may be best one example of this type of bean per executing Job.
<bean id="..." class="..." scope="job">
Log4j Interview Questions
Question 18. How Do We Track The Number Of Item Processed By The Itemreader In Spring Batch?
Answer :
The item mapping bean can implement org.Springframework.Batch.Object. ItemCountAware, a marker interface to have the object role tracked.
Hibernate Interview Questions
Question 19. Define A Job In Spring Batch?
Answer :
A Job is an entity that encapsulates a whole batch manner.
Job might be stressed out collectively using a XML configuration report or Java based totally configuration. This configuration is likewise referred as "process configuration".
A Job is sincerely a box for Steps and it combines more than one steps that runs logically collectively in a waft.
JUnit Tutorial
Question 20. What Is Job Launcher In Spring Batch Framework?
Answer :
JobLauncher represents a simple interface for launching a Job with a given set of JobParameters.
Spring MVC Framework Interview Questions
Question 21. What Is Executioncontext?
Answer :
An ExecutionContext represents a group of key/price pairs which can be endured and controlled with the aid of the framework so as to provide the builders a placeholder to keep continual kingdom that is scoped to a StepExecution or JobExecution.
Question 22. How Do You Run Spring Batch Jobs In Production Environment?
Answer :
Usually The Java batch Job foremost elegance and its dependencies are passed to the java command and it is stored in a command line Batch report or shell script in phrases of linux/unix.
These script document may be run the use of scheduler like Autosys on the Production surroundings.
Log4j Tutorial
Question 23. What Is Commandlinejobrunner In Spring Batch?
Answer :
CommandLineJobRunner is one of the ways to bootstrap your Spring batch Job. The xml script launching the activity needs a Java magnificence major approach as as entry factor and CommandLineJobRunner lets you begin your task immediately using the XML script.
The CommandLineJobRunner plays four responsibilities:
Load the appropriate ApplicationContext.
Parse command line arguments into JobParameters.
Locate the best activity based on arguments.
Use the JobLauncher furnished in the utility context to release the task..
The CommandLineJobRunner arguments are jobPath, the location of the XML record so one can be used to create an ApplicationContext and the jobName, the call of the process to be run.
Bash$ java CommandLineJobRunner DailyJobConfig.Xml processDailyJob
These arguments ought to be exceeded in with the route first and the name 2d. All arguments after these are taken into consideration to be JobParameters and need to be within the format of 'name=fee'.
Java J2ee Architect Interview Questions
Question 24. What Is Resourceaware Is Spring Batch?
Answer :
ResourceAware is a marker interface a good way to set the current useful resource on any item that enforce this interface.
MVC Framework Interview Questions
Question 25. Difference Between Spring Batch And Quartz Scheduler?
Answer :
Spring Batch and Quartz have exceptional functions and duty. Spring Batch gives functionality for processing big volumes of statistics even as Quartz presents functionality for scheduling responsibilities. Thus Quartz should complement Spring Batch and a common mixture could be to use Quartz as a cause for a Spring Batch process using a Cron expression.
Spring MVC Framework Tutorial
Question 26. How Do I Schedule A Job With Spring Batch?
Answer :
Use a scheduling tool inclusive of Quartz, Control-M or Autosys. Quartz islight weight, doesn't have all the features of Control-M or Autosys. Even the OS based totally Task scheduler, CRON jobs will be used to time table Spring batch jobs.
Spring Boot Interview Questions
Question 27. How Can I Make An Item Reader Thread Safe In Spring Batch?
Answer :
You can synchronize the examine() method. Remember that you may lose restartability, so fine practice is to mark the step as no longer restartable and to be safe (and green) you could additionally set saveState=false at the reader.
Framework7 Interview Questions
Question 28. What Is The Latest Version Of Spring Batch?
Answer :
The available trendy version is three.0.7.
Question 29. What Is Itemreader In Spring Batch Framework?
Answer :
ItemReader is an abstraction that represents the retrieval of input for a Step, one object/row/report at a time. When the ItemReader has exhausted the gadgets it could provide, it'll indicate this by way of returning null.
Spring Security Interview Questions
Question 30. What Is Itemwriter In Spring Batch Framework?
Answer :
ItemWriter is an abstraction that represents the output of a Step, one batch or chunk of items at a time. Generally, an item author has no understanding of the enter it's going to receive subsequent, simplest the object that become handed in its cutting-edge invocation.
Question 31. What Is Itemprocessor?
Answer :
ItemProcessor is an abstraction that represents the commercial enterprise processing of an object. While the ItemReader reads one item, and the ItemWriter writes them, the ItemProcessor affords get entry to to convert or observe different business processing. If, at the same time as processing the item, it's far determined that the object is not legitimate, returning null suggests that the object have to no longer be written out.
Question 32. Mention The Different Itemreader And Itemwriter Implementations Available In Spring Batch?
Answer :
There are many implementations such as the ones that allow read and write operations on,
Flat File.
Xml.
Hibernate Cursor.
JDBC.
JMS.
Hibernate Paging.
Stored Procedure.
Question 33. Name Few Of The Domain Buzzwords In Spring Batch?
Answer :
Job.
JobLauncher.
JobRepository.
JobInstance.
JobExecution.
JobParameters.
Maven Interview Questions
Question 34. What Job Configuration Consists Of?
Answer :
The job configuration consists of,
The simple call of the task.
Definition and order of the Steps.
Configurable international(to all steps) residences including restartablity.
Question 35. What Is Jobinstance?
Answer :
A JobInstance represents the idea of a logical activity run.
Question 36. Difference Between Step And Stepexecution?
Answer :
A Step is a site item that encapsulates an impartial and sequential segment of a batch job while a StepExecution represents a unmarried try to execute a step.
JUnit Interview Questions
Question 37. Define Executioncontext?
Answer :
An ExecutionContext represents a set of key-value pairs which are persisted and managed with the aid of the framework for you to permit developers an area to shop continual state that is scoped to a StepExecution or JobExecution.
Question 38. What Are The Required Dependencies For Configuring A Job?
Answer :
There are three required dependencies:
Job name,
JobRepository,
and one or greater steps.
Question 39. How Do I Setup Spring Batch Job Without Using Xml?
Answer :
Spring three allows the capacity to configure programs the use of java as opposed to XML and from Spring Batch 2.2.0, batch jobs can be configured using the same java config.
There are 2 components for the java primarily based configuration:
the @EnableBatchConfiguration annotation and two developers.
@EnableBatchProcessing presents a base configuration for building batch jobs.
The center interface for this configuration is the BatchConfigurer. The default implementation offers the beans to be autowired along with JobRepository, JobLauncher.
Question forty. Explain The Role Of Jobrepository In Spring Batch?
Answer :
The JobRepository is used for basic CRUD operations of the various endured area items within Spring Batch, along with JobExecution and StepExecution. It is required by a number of the foremost framework functions, including the JobLauncher, Job, and Step.
Log4j Interview Questions
Question forty one. What Is The Default Isolation Level Of Spring Batch Transactions?
Answer :
It is SERIALIZABLE by means of default to save you the same task instance being performed simultaneously.
Question forty two. What Is A Cron Job?
Answer :
A cron process is a Linux command for scheduling script to your server to execute repetitive tasks routinely. Scripts finished as a cron activity are typically used to modify files, databases and manipulate caching.
Spring MVC Framework Interview Questions
Question 43. How Cron Job Works In Linux?
Answer :
Cron is a daemon that executes scheduled instructions. Cron is began robotically from /etc/init.D on getting into multi-person runlevels. Cron searches its spool place (/var/spool/cron/crontabs) for crontab files (that are named after debts in /etc/passwd); crontabs observed are loaded into memory.
Cron wakes up each minute, analyzing all saved crontabs, checking every command to look if it must be run inside the current minute. When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable within the crontab, if such exists).
