Skip to content

Instantly share code, notes, and snippets.

@karol-lotkowski
Created October 19, 2015 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karol-lotkowski/bbccc36d19a04c090741 to your computer and use it in GitHub Desktop.
Save karol-lotkowski/bbccc36d19a04c090741 to your computer and use it in GitHub Desktop.
Dropwizard clean code application class.
package com.karollotkowski.cleancode;
import com.karollotkowski.cleancode.repositories.JsonFileRulesRepository;
import com.karollotkowski.cleancode.resources.RulesResource;
import io.dropwizard.Application;
import io.dropwizard.setup.Environment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CleanCodeApplication extends Application<AppConfiguration> {
private static final Logger LOGGER = LoggerFactory.getLogger(CleanCodeApplication.class);
public static void main(final String[] args) throws Exception {
new CleanCodeApplication().run(args);
}
@Override
public void run(final AppConfiguration configuration, final Environment environment)
throws Exception {
LOGGER.info("Starting application with name: {}", configuration.getAppName());
final JsonFileRulesRepository rulesRepository = new JsonFileRulesRepository();
final RulesResource rulesResource = new RulesResource(rulesRepository);
environment.jersey().register(rulesResource);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment