Skip to content

Dropwizard App

devlibx edited this page Aug 12, 2024 · 2 revisions

This provides the base application for your application:

  1. Support virtual thread
  2. Dropwizard 4

Add dropwizard-app

<dependency>
    <groupId>io.github.devlibx.easy</groupId>
    <artifactId>dropwizard-app-v2</artifactId>
    <version>0.0.143</version>
</dependency>

Migration to jakarta (Mandatory)

Dropwizard 4 need migration from javax.ws.rs to jakarta.ws.rs. You can do find and replace to change imports. Without this your resource will not be registered and you will not expose the rest apis from your application.

Important

  • Use new io.dropwizard.core import Use new package path - io.dropwizard.core.Configuration and io.dropwizard.core.setup.Environment
  • Add enableVirtualThreads=true to enable dropwizard to use Virtual Threads
server:
  type: simple
  applicationContextPath: /your-path
  adminContextPath: /admin
  connector:
    port: 8080
    type: http
  enableVirtualThreads: true

Clone this wiki locally