Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.yammer.dropwizard;
The base class for Dropwizard services.

<T> the type of configuration class for this service
public abstract class Service<T extends Configuration> {
    static {
        // make sure spinning up Hibernate Validator doesn't yell at us

Returns the java.lang.Class of the configuration class type parameter.

    public final Class<T> getConfigurationClass() {
        return Generics.getTypeParameter(getClass(), Configuration.class);

Initializes the service bootstrap.

bootstrap the service bootstrap
    public abstract void initialize(Bootstrap<T> bootstrap);

When the service runs, this is called after the Bundles are run. Override it to add providers, resources, etc. for your service.

configuration the parsed com.yammer.dropwizard.config.Configuration object
environment the service's com.yammer.dropwizard.config.Environment
java.lang.Exception if something goes wrong
    public abstract void run(T configurationEnvironment environmentthrows Exception;

Parses command-line arguments and runs the service. Call this method from a public static void main entry point in your application.

arguments the command-line arguments
java.lang.Exception if something goes wrong
    public final void run(String[] argumentsthrows Exception {
        final Bootstrap<T> bootstrap = new Bootstrap<T>(this);
        bootstrap.addCommand(new ServerCommand<T>(this));
        final Cli cli = new Cli(this.getClass(), bootstrap);;
New to GrepCode? Check out our FAQ X