Class VertxApplication

java.lang.Object
io.vertx.launcher.application.VertxApplication

public class VertxApplication extends Object
A main() class that can be used to create the Vert.x instance and deploy a verticle.

It can be used, for example, as the main class of an executable uber-jar, so that you can run verticles directly with: java -jar myapp.jar.

  • Constructor Details

    • VertxApplication

      public VertxApplication(String[] args)
      Create a new instance with the given program arguments and default behavior (print usage and exit on failure).

      Subclasses may implement VertxApplicationHooks. In this case, this object's hook methods will be invoked at different stages of the launch process.

      Parameters:
      args - the program arguments
    • VertxApplication

      public VertxApplication(String[] args, VertxApplicationHooks hooks)
      Like VertxApplication(String[]), with the provided hooks.
      Parameters:
      args - the program arguments
      hooks - an instance of VertxApplicationHooks to be invoked at different stages of the launch process
    • VertxApplication

      protected VertxApplication(String[] args, VertxApplicationHooks hooks, boolean printUsageOnFailure, boolean exitOnFailure)
      May be invoked by subclasses to customize behavior.

      When the hooks parameter is null, the application instance will be used if it implements VertxApplicationHooks.

      Parameters:
      args - the program arguments
      hooks - an instance of VertxApplicationHooks to be invoked at different stages of the launch process (maybe null)
      printUsageOnFailure - whether usage should be printed to System.out if the application failed to start
      exitOnFailure - whether the JVM should be terminated with a specific exitCode if the application failed to start
  • Method Details

    • main

      public static void main(String[] args)
    • launch

      public int launch()
      Launches the Vert.x application.
      Returns:
      an exit code, 0 means the verticle has been deployed successfully