Reply to comment
spring batch
Here are a few tips if you want to incorporate the spring batch project...
1) Make sure you get the xsd and namespace stuff right in your resources.xml file I had to combine a few namespaces from the example files and ended up with an extra double quote that affected the bean creation.
Here's where I ended it:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
2) Make sure that you are looking at the correct common-context.xml
There are several of these files named the same, but each different.
3) spring batch will not just automatically create your tables. If I am wrong, let me know! The junit tests make use of a datasource initializer class that is in the TEST jar. I added the test jar to my grails project so that i could use it (spring-batch-test-2.1.0.CI-SNAPSHOT.jar)
<bean id="dataSourceInitializer" class="org.springframework.batch.test.DataSourceInitializer">
<property name="dataSource" ref="dataSource" />
<property name="initScripts">
<list>
<!-- This works -->
<value>classpath:/schema-hsqldb.sql</value>
<value>classpath:/business-schema-hsqldb.sql</value>
<!--
This doesn't work
<value>/cygdrive/c/usr/local/spring-batch/spring-batch/spring-batch-core/target/generated-resources/schema-hsqldb.sql</value>
<value>/cygdrive/c/usr/local/spring-batch/spring-batch/spring-batch-core-tests/src/main/resources/business-schema-hsqldb.sql</value>
-->
</list>
</property>
</bean>
Again, the only way I found this was by removing every thing in resources.xml until I had the bean above, and it failed when trying to get a reference to the bean. I really wish that Groovy would through a class not found exception.
4) This was a handy snippet that I added to my Bootstrap.groovy file that I could verify that the beans that were in resources.xm
def init = { servletContext ->def dataSourceInitializer = grailsApplication.mainContext.getBean("dataSourceInitializer")grailsApplication.mainContext.beanDefinitionNames.each {
println it}
}
