Bootstrapping your application

Every serious application needs certain resources to be prepared at startup. You can implement such a bootstrapping process by adding one class to your code. In case your base package is org.jzonic.test then you simply add a class called ApplicationStartup to the base package. This class needs to look like this:

import org.jzonic.init.Bootstrap;

public class ApplicationStartup implements Bootstrap {

public void init(ServletConfig sc) throws BootstrapException { }

public void shutdown() throws BootstrapException { } }

During the initialisation of the framework it will automatically check if there is a class in thebase package called ApplicationStartup and in case it is found will execute the init method. When the server is shutting down the application the shutdown method is called.

In the init method you can do whatever you want and prepare and resource that you need.

Page: ApplicationStartup last edited by admin on 03/19/2009 21:01 revision: 0
Labels:  (none)    Permalink