Package org.springframework.batch.test
Class DataSourceInitializer
- java.lang.Object
- org.springframework.batch.test.DataSourceInitializer
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean
public class DataSourceInitializer extends java.lang.Object implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBeanWrapper for aDataSourcethat can run scripts on start up and shut down. Use as a bean definition
Run this class to initialize a database in a running server process. Make sure the server is running first by launching the "hsql-server" from thehsql.serverproject. Then you can right click in Eclipse and Run As -> Java Application. Do the same any time you want to wipe the database and start again.- Author:
- Dave Syer, Drummond Dawson, Mahmoud Ben Hassine
Constructor Summary
Constructors Constructor Description DataSourceInitializer()
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()voiddestroy()static voidmain(java.lang.String... args)Main method as convenient entry point.voidsetDataSource(javax.sql.DataSource dataSource)voidsetDestroyScripts(org.springframework.core.io.Resource[] destroyScripts)voidsetIgnoreFailedDrop(boolean ignoreFailedDrop)voidsetInitScripts(org.springframework.core.io.Resource[] initScripts)
Method Detail
main
public static void main(java.lang.String... args)
Main method as convenient entry point.- Parameters:
args- arguments to be passed to main.
destroy
public void destroy()
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
setInitScripts
public void setInitScripts(org.springframework.core.io.Resource[] initScripts)
setDestroyScripts
public void setDestroyScripts(org.springframework.core.io.Resource[] destroyScripts)
setDataSource
public void setDataSource(javax.sql.DataSource dataSource)
setIgnoreFailedDrop
public void setIgnoreFailedDrop(boolean ignoreFailedDrop)