Skip to content

Instantly share code, notes, and snippets.

@der3k
Last active August 29, 2015 14:03
Show Gist options
  • Save der3k/1239a1cd31b89e07ed6f to your computer and use it in GitHub Desktop.
Save der3k/1239a1cd31b89e07ed6f to your computer and use it in GitHub Desktop.
DW 6.x to 7.x migration

Migrate Dropwizard from 6.x to 7.x

Replace All

  • com.yammer.dropwizard -> io.dropwizard in whole project
  • com.yammer.metrics.annotation.Timed; -> import com.codahale.metrics.annotation.Timed;
  • io.dropwizard.json.JsonSnakeCase; -> import io.dropwizard.jackson.JsonSnakeCase;

Update Configuration class

  • import io.dropwizard.Configuration;
  • io.dropwizard.db.DatabaseConfiguration -> io.dropwizard.db.DataSourceFactory

Update Service class

import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;

Refactor

  • bootstrap.getObjectMapperFactory() -> bootstrap.getObjectMapper()
  • environment.addFilter() -> environment.servlets().addFilter()
  • environment.addResource() -> environment.jersey().register()

Update YAML configuration

logging:
  level: WARN
  loggers:
    "net.snet": DEBUG

  appenders:
    - type: console
      logFormat: "%d{yyyyMMdd HH:mm:ss.SSS} %5p %m%n"

    - type: file
      threshold: DEBUG
      currentLogFilename: log/crm-service.log
      archivedLogFilenamePattern: log/crm-service-%d{yyyy-MM-dd}.log.gz
      archivedFileCount: 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment