(POM) in this project is preconfigured to create a jar file, with CommandLineJobRunner defined as the main
class by default. For this example, you update the POM to use the Batch class from Listing 5-11 as the
main method for your jar. Listing 5-14 shows the snippet that needs to be updated.
Listing 5-14. Maven Jar Plug-in Configured to Run Batch
With the POM updated, you can use the same command you have in the past to launch the
program: java -jar metadata-0.0.1-SNAPSHOT.jar.
Notice that when you run the program, the output is quite different. This time, no job runs. Instead,
you see Spring bootstrap and register the job helloWorldJob from the helloWorld.xml file, as shown in
Listing 5-16. The registration of the helloWorld job.
2010-12-16 21:17:41,390 DEBUG com.apress.springbatch.chapter5.Batch.main()
[org.springframework.batch.core.configuration.support.DefaultJobLoader] - <Registering job:
helloWorldJob1 from context: file:/Users/mminella/Documents/SpringBatch/Chapter5/batch-
With the Batch process running, you view the beans exposed via JMX using Java's JConsole.
JConsole is a free Java monitoring and management tool provided with the JDK. It allows you to monitor
the JVM in a number of ways, including CPU utilization and memory allocation, and it lets you perform
management tasks including interacting with JMX beans. When you launch JConsole, you're presented
with a screen that asks you which Java process you would like to connect to, as shown in Figure 5-2.