Class 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.DisposableBean
    Wrapper for a DataSource that 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 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, Drummond Dawson, Mahmoud Ben Hassine
    • Constructor Detail

      • DataSourceInitializer

        public DataSourceInitializer()
    • 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:
        destroy in interface org.springframework.beans.factory.DisposableBean
      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.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)