Recommended Free Tools
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Yes—you can build and run a Dropwizard Hello World REST API on Java 25. The current stable getting-started documentation uses Dropwizard 5.0.2, which requires Java 17 or newer and Maven 3.6 or newer. Java 25 is above that runtime baseline, and Dropwizard 5.0.2 release notes list CI builds with Java 25. This tutorial creates a YAML-configured application, exposes GET /hello-world, packages the service as a Maven Shade fat JAR, and runs it with separate application and administration ports.
You will finish with an endpoint that returns JSON such as {"id":1,"content":"Hello, Dougie!"}, while also seeing how Dropwizard connects Configuration, Application, Environment, Jersey, Jackson, Metrics, and Jetty.
As an Amazon Associate I earn from qualifying purchases.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
What do I need before creating a Dropwizard API with Java 25?
Install a Java 25 JDK, Maven 3.6 or newer, and a shell. Verify both tools before creating the project:
java -version
mvn -version
Dropwizard 5.0.x has a documented minimum of Java 17 because its Jetty 12 generation requires Java 17 or later. Java 25 therefore satisfies the supported baseline, but your build must use a 5.0.x dependency set rather than an older Dropwizard line built around pre-Jakarta APIs.
Popular on Amazon
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
The version used here is Dropwizard 5.0.2. Its 5.0.x stack uses Jetty 12.1, Jersey 3.1, Jackson 2.20, and Jakarta EE 10. Those generations matter when you import annotations: use jakarta.ws.rs packages, not the older javax.ws.rs packages used by many Dropwizard 4-era examples.
How does a Dropwizard application fit together?
Dropwizard is an application-oriented Java framework that combines Jetty for HTTP, Jersey for REST resources, Jackson for JSON and YAML mapping, Metrics for operational measurements, logging, and validation. Its startup model has three important classes:
- Configuration maps YAML properties into a typed object and validates required values.
- Application owns process startup and receives the parsed configuration.
- Environment is the runtime registry used in
runto register resources, health checks, tasks, and other components.
Jersey annotations determine the URL and HTTP method. Jackson serializes the object returned by a resource into JSON. A resource can be called by multiple request threads at once, so mutable state must be protected; the example uses AtomicLong for its identifier counter.
How do I create the Maven project and add the Dropwizard dependency?
Create a directory and the standard Maven source tree:
hello-world/
├── pom.xml
├── hello-world.yml
└── src/
└── main/
└── java/
└── com/
└── example/
└── helloworld/
Use the Dropwizard bill of materials (BOM) in dependencyManagement. The BOM keeps Dropwizard modules on compatible versions while your application declares the main dependency explicitly.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>hello-world</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven.compiler.release>25</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dropwizard.version>5.0.2</dropwizard.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-bom</artifactId>
<version>${dropwizard.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
<goals><goal>shade</goal></goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.example.helloworld.HelloWorldApplicationStart</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The compiler release is set to 25 so Maven compiles against the Java 25 language and platform API. If your organization standardizes on a lower release while running Maven on Java 25, set maven.compiler.release to that target instead; the Dropwizard runtime still needs Java 17 or newer.
Free tools Windows power users keep installed
One-click scans. No signup required.
The Shade configuration writes the application main class into the JAR manifest, merges META-INF/services files used by Java’s ServiceLoader mechanism, and removes signature files that cannot remain valid after repackaging. Do not enable minimizeJar casually: Dropwizard extensions discovered through ServiceLoader or reflection can be removed when Maven tries to eliminate apparently unused classes.
How do I define YAML-backed configuration?
Create src/main/java/com/example/helloworld/HelloWorldConfiguration.java. The fields are populated from YAML and validated before startup continues.
Also popular on Amazon
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
package com.example.helloworld;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.core.Configuration;
import jakarta.validation.constraints.NotEmpty;
public class HelloWorldConfiguration extends Configuration {
@NotEmpty
private String template;
@NotEmpty
private String defaultName = "Stranger";
@JsonProperty
public String getTemplate() {
return template;
}
@JsonProperty
public void setTemplate(String template) {
this.template = template;
}
@JsonProperty
public String getDefaultName() {
return defaultName;
}
@JsonProperty
public void setDefaultName(String defaultName) {
this.defaultName = defaultName;
}
}
@JsonProperty tells Jackson to expose the accessors during YAML mapping. @NotEmpty rejects a missing or empty value, so a configuration error is reported at startup instead of producing a malformed response later.
Place the matching configuration file at the project root as hello-world.yml:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →template: Hello, %s!
defaultName: Stranger
The %s placeholder is filled with the selected name by the resource. YAML keys are case-sensitive in practice when they are mapped to Java properties, so keep the names aligned with the accessors.
How do I create the JSON representation?
Create a small immutable value type named Saying. A Java record keeps the representation concise and Jackson serializes its components as JSON properties.
package com.example.helloworld;
public record Saying(long id, String content) {
}
For a request that chooses the name Dougie, this representation becomes {"id":1,"content":"Hello, Dougie!"}. The numeric identifier is process-local and intended to distinguish responses during the life of this application; it is not a database key.
How do I implement the GET /hello-world resource?
Create HelloWorldResource.java. The class declares the path and response media type, accepts an optional query parameter, formats the configured template, and increments a thread-safe counter.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minutepackage com.example.helloworld;
import com.codahale.metrics.annotation.Timed;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
@Path("/hello-world")
@Produces(MediaType.APPLICATION_JSON)
public class HelloWorldResource {
private final String template;
private final String defaultName;
private final AtomicLong counter = new AtomicLong();
public HelloWorldResource(String template, String defaultName) {
this.template = template;
this.defaultName = defaultName;
}
@GET
@Timed
public Saying sayHello(@QueryParam("name") Optional<String> name) {
String value = name.orElse(defaultName);
return new Saying(counter.incrementAndGet(), String.format(template, value));
}
}
@Path maps the class to /hello-world, while @GET maps the method to HTTP GET. @Produces makes the response JSON. @QueryParam("name") Optional<String> distinguishes an omitted parameter from a supplied one. The @Timed annotation records invocation timing in Dropwizard Metrics.
An absent parameter, as in /hello-world, uses defaultName. A supplied value, as in /hello-world?name=Dougie, is inserted into the template. An explicitly empty value, name=, is not the same as an absent parameter. If empty input should fall back to the default, use Dropwizard’s NonEmptyStringParam parameter type and convert its value before formatting.
Also popular on Amazon
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
How do I register the resource and start the application?
Create HelloWorldApplicationStart.java. The application class connects configuration to the resource registry.
package com.example.helloworld;
import io.dropwizard.core.Application;
import io.dropwizard.core.setup.Bootstrap;
import io.dropwizard.core.setup.Environment;
public class HelloWorldApplicationStart extends Application<HelloWorldConfiguration> {
public static void main(String[] args) throws Exception {
new HelloWorldApplicationStart().run(args);
}
@Override
public String getName() {
return "hello-world";
}
@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
// Add bundles here when the application grows.
}
@Override
public void run(HelloWorldConfiguration configuration,
Environment environment) {
HelloWorldResource resource = new HelloWorldResource(
configuration.getTemplate(),
configuration.getDefaultName());
environment.jersey().register(resource);
}
}
Dropwizard parses and validates the YAML before calling run. The Environment then registers the resource with Jersey. Keeping construction here makes the resource’s dependencies explicit and avoids reading configuration files from request-handling code.
How do I build and run the Dropwizard fat JAR?
From the directory containing pom.xml, package the application:
mvn package
Maven compiles the classes, resolves the BOM-managed dependencies, and creates a shaded artifact under target. With the coordinates above, run it in server mode and pass the YAML file as the final argument:
java -jar target/hello-world-0.0.1-SNAPSHOT.jar server hello-world.yml
Dropwizard’s example configuration exposes application requests on port 8080 and administration requests on port 8081. The application port serves your Jersey endpoint. The administration port is reserved for operational endpoints such as metrics and thread information; do not expose it publicly without appropriate network controls.
The shaded JAR and the YAML file form the demonstrated deployment unit. Copy both to the target machine, install a Java 17-or-newer runtime, and invoke the same server command. Keep environment-specific values in a separate YAML file rather than rebuilding the JAR for every deployment.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →How do I verify the endpoint and query-parameter behavior?
Once startup logging indicates that the server is listening, issue requests from another terminal:
- Use the configured default:
curl http://localhost:8080/hello-worldExpected shape:
{"id":1,"content":"Hello, Stranger!"}.Also popular on Amazon
SaleUGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
- Supply a name:
curl 'http://localhost:8080/hello-world?name=Dougie'The content uses
Dougie, and the identifier increases for the next invocation. - Check an explicitly empty value:
curl 'http://localhost:8080/hello-world?name='This tests the distinction between an empty supplied parameter and an omitted parameter. Use
NonEmptyStringParamif your API contract requires empty input to behave like omission.Recommended: Fix Windows Errors and Clear Junk Files in Minutes - Free Scan →Recommended: Update Every Outdated Driver on Your PC in One Scan - Free →Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. - Inspect administration data:
curl http://localhost:8081/metrics curl http://localhost:8081/threadsThe exact JSON includes framework and application metrics; the timed resource contributes invocation timing data.
URL-encode names containing spaces, ampersands, or non-ASCII characters. For example, send name=Jane%20Doe rather than placing a literal space in the URL.
What makes the resource safe under concurrent requests?
Jetty can dispatch multiple requests concurrently. The resource stores only immutable configuration strings and an AtomicLong, whose increment operation is thread-safe. Avoid ordinary mutable counters, request-specific fields on the resource instance, or unsynchronized collections.
For larger applications, prefer immutable collaborators and inject services that are themselves concurrency-safe. If a dependency is stateful, define its ownership and synchronization policy explicitly. The identifier in this example resets whenever the process restarts and does not guarantee a globally unique value across multiple instances.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11What usually fails when packaging or starting a Dropwizard service?
- “Unsupported class file” or compiler errors: confirm that Maven is using the intended Java 25 JDK and that
maven.compiler.releasematches the JDK available to the build. - Missing or invalid YAML values: check indentation, property spelling, and the required
templatevalue. Validation errors occur before the server starts. ClassNotFoundExceptionafter packaging: run the shaded artifact, not a thin original JAR, and verify that the Shade manifest namescom.example.helloworld.HelloWorldApplicationStart.- ServiceLoader-based features stop working: ensure
ServicesResourceTransformeris present and do not useminimizeJarunless every reflective and ServiceLoader dependency has been tested. - 404 on the endpoint: confirm the command includes
server, the application is listening on 8080, and the path is exactly/hello-world. - Port already in use: stop the process holding 8080 or 8081, or change the application and admin connector ports in the YAML configuration used by your deployment.
- Imports fail after upgrading: Dropwizard 5 uses Jakarta EE 10. Replace old
javax.ws.rsimports with the correspondingjakarta.ws.rsimports.
What changed between Dropwizard 4.x and 5.x?
Dropwizard 5 is not just a version-number change. It raises the Java baseline and updates the web and serialization stack, so code written for 4.x may require import and dependency changes.
| Area | Dropwizard 4.x | Dropwizard 5.0.x |
|---|---|---|
| Java baseline | Older Java baseline, depending on the 4.x release | Java 17 or newer |
| HTTP server | Earlier Jetty generation | Jetty 12.1 |
| REST stack | Earlier Jersey generation | Jersey 3.1 |
| Namespace | Pre-Jakarta APIs in common examples | Jakarta EE 10 |
| JSON stack | Earlier Jackson line | Jackson 2.20 |
| Java 25 build status | Not established by the 5.0.2 release notes | 5.0.2 release notes list CI builds with Java 25 |
For a new Java 25 service, use the 5.0.2 BOM and update imports to Jakarta packages. If migrating an existing service, audit JAX-RS imports, custom Jersey extensions, Jetty integrations, and any library that still expects the older namespace before switching the parent version.
Also popular on Amazon
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
When should I keep this example small, and when should I extend it?
This structure is enough for a single endpoint or a learning project. Add a database, authentication, external clients, or multiple resources only after deciding where those concerns belong.
- Put request and response shapes in representation classes rather than exposing persistence entities directly.
- Keep configuration values in typed configuration classes and environment-specific YAML files.
- Register each resource and health check in
run, where startup dependencies are visible. - Use the administration port and Metrics data for operational observation, while protecting that port at the network boundary.
- Add automated tests for absent, populated, and empty
namevalues so the API contract remains clear.
The core deployment remains straightforward: a shaded JAR, a compatible Java runtime, and a YAML configuration file. That simplicity is the main reason Dropwizard works well for focused, operations-aware REST services.
Frequently Asked Questions
Can I run Dropwizard 5.0.2 on a Java 25 JRE instead of a full JDK?
Yes for execution, provided the JAR was already built and the runtime is Java 17 or newer. You need a JDK, rather than only a JRE-style runtime, wherever Maven must compile the project.
Why does Dropwizard require a separate admin port?
The separate connector keeps operational endpoints such as metrics and thread data apart from application traffic. You can restrict that port to an internal network or management plane without changing the public API listener.
How can I change the 8080 and 8081 ports without recompiling?
Put server connector settings in the YAML file passed to the server command, then run the JAR with that file. This lets development, staging, and production use different listeners while sharing one artifact.
Does the AtomicLong identifier remain unique after a restart or across servers?
No. It is an in-memory counter that resets when the process restarts and can repeat on another instance. Use a database sequence or a distributed identifier service when an API needs durable or cross-instance uniqueness.
What should I test if a name contains special characters?
Test URL encoding and verify that the decoded value reaches the resource as intended. Include spaces, ampersands, Unicode characters, and an empty value in automated request tests.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

