3 Launching
This chapter introduces how to launch a Ratpack application, and the associated launch time configuration.
3.1 Launch configuration
To launch a Ratpack application, you must create a LaunchConfig
. This can then be used with the RatpackServerBuilder
method to create a RatpackServer
that can then be started.
Note that one of the LaunchConfig
object’s responsibilities is to provide a HandlerFactory
implementation. This factory is responsible for creating the handler that is effectively the Ratpack application. See the chapter on handlers for more details.
One option for building a LaunchConfig
is to use the LaunchConfigBuilder
. Another option is to use the LaunchConfigFactory
which is able to build a launch config from system properties and a properties file.
3.2 Main classes
Ratpack also provides some ready to use “main” classes that can be used to start the application. These main classes build on top of LaunchConfigFactory
.
The RatpackMain
is a bare bones entry point and is suitable for use in most cases.
The GroovyRatpackMain
entry point configures a Groovy based application to be launched.