Java Reference
In-Depth Information
<project_home>/src/main/java/example : This directory contains sample readers
and writers that you don't need in this project.
<project_home>/src/main/java/test : You don't use the DataSourceInitializer to
initialize the database schema for this project, and it isn't recommended for use in
production.
<project_home>/src/main/resources/META-INF/spring : As you have throughout
the topic, you configure the job XML files in the directory
<project_home>/src/main/resources/jobs , so this directory and its contents aren't
needed.
<project_home>/src/test/java/example : Because you deleted the example
ItemReader and ItemWriter included in the shell, you don't need their unit tests.
<project_home>/src/test/resources/test-context.xml : You do the required
configuration for the unit tests slightly differently than using this file, so it isn't
needed.
With the project now much leaner, you still need to do a bit more pruning. Specifically, the launch-
context.xml file has a reference to the DataSourceInitializer that you need to remove now that your
project no longer includes that class.
After you've removed the pieces that won't be used in the project, you should update some of the
remaining files. Specifically, you should update the POM file to use Spring 3 and add the MySQL driver
dependency. You also need to remove the reference to the DataSourceInitializer from the launch-
context.xml file because you deleted it earlier.
Let's start with the POM file updates. Spring does a good job of abstracting the versions of the
frameworks you're using, so changing the version of Spring you use requires that you update the
spring.framework.version property located near the top of the POM file. Listing 10-1 shows the update
you need to make.
Listing 10-1. Updating the Spring Version to Spring 3
<properties>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<spring.framework.version>3.0.5.RELEASE</spring.framework.version>
<spring.batch.version>2.1.7.RELEASE</spring.batch.version>
<dependency.locations.enabled>false</dependency.locations.enabled>
</properties>
You also need to add the MySQL driver to the POM file because, as mentioned earlier, you use
MySQL for the project. Listing 10-2 shows the Maven dependency you need to add to the POM file.
Listing 10-2. MySQL Maven Dependency
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.3</version>
 
Search WWH ::




Custom Search