org.springframework.batch.test
Class DataSourceInitializer

java.lang.Object
  extended by org.springframework.batch.test.DataSourceInitializer
All Implemented Interfaces:
DisposableBean, InitializingBean

public class DataSourceInitializer
extends Object
implements InitializingBean, DisposableBean

Wrapper for a DataSource that can run scripts on start up and shut down. Us 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 the hsql.server project. 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

Constructor Summary
DataSourceInitializer()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
static void main(String... args)
          Main method as convenient entry point.
 void setDataSource(DataSource dataSource)
           
 void setDestroyScripts(Resource[] destroyScripts)
           
 void setIgnoreFailedDrop(boolean ignoreFailedDrop)
           
 void setInitScripts(Resource[] initScripts)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSourceInitializer

public DataSourceInitializer()
Method Detail

main

public static void main(String... args)
Main method as convenient entry point.

Parameters:
args -

destroy

public void destroy()
Specified by:
destroy in interface DisposableBean

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

setInitScripts

public void setInitScripts(Resource[] initScripts)

setDestroyScripts

public void setDestroyScripts(Resource[] destroyScripts)

setDataSource

public void setDataSource(DataSource dataSource)

setIgnoreFailedDrop

public void setIgnoreFailedDrop(boolean ignoreFailedDrop)


Copyright © 2013 SpringSource. All Rights Reserved.