What is Dropwizard Bundle?
To put it simply, a Dropwizard Bundle is a reusable group of functionality that is used to define an application server’s behavior. It is done by implementing the ConfiguredBundle interface.

Advantages of Dropwizard Bundles
-
Bundles can be thought of as extension points that helps you to expand the capabilities of Dropwizard.
-
Bundles are like add-ons to Dropwizard that make it very easy to add small pieces of functionality.
- While working with libraries on Dropwizard, the bundles can be extracted to another library and can be reused across the project that you are working on.
Implementation
Now let us see how this ConfiguredBundle interface is implemented:
During initialization, we use the syntax given below:
public interface ConfiguredBundle<T> {
default void run(T configuration, Environment environment) throws Exception {
// Do nothing
}
/**
* Initializes the application bootstrap.
*
* @param bootstrap the application bootstrap
*/
default void initialize(Bootstrap<?> bootstrap) {
// Do nothing here
}
}
@Override
public void initialize(Bootstrap<MyApiConfiguration> bootstrap)
{
bootstrap.addBundle(hibernate);
}
As you can see, the ‘addBundle’ method has been used above. Now, let’s see what it does:
- It calls the initialize method for your bundle.
-
It adds your bundle to an ArrayList, which will be utilized in the run method later.
Post the initialization, Dropwizard will iterate over all bundles. It will then call the run method for each one.
Reuse Bundles
We need to reuse the bundles in our Dropwizard project.
bootstrap.addBundle(new MyBundle<>());
Serving Assets
A service asset is any resource or capability that can be used to help offer a service. You can choose to manage an asset for operational, financial, or contractual reasons.
-
The root path can serve either your application or static assets, but not both. The latter is useful for backing up a Javascript application with Dropwizard. Move your application to a sub-URL to activate it. Do it as mentioned:
Server:
rootPath: /api/
-
Then, from the root path, use an expanded AssetsBundle constructor to serve resources in the assets folder, and the rootpath.index.htm is served as the default page.
-
When an AssetBundle is added to an application, it is registered as a servlet(an applet that runs on a server, typically within Java) with the name assets as the default name. If the application requires numerous AssetBundle objects, use the extended constructor to specify a unique name for the AssetBundle.
SSL Reload

What exactly is SSL, and why do I need it?
SSL is an abbreviation for Secure Sockets Layer, a security protocol that establishes an encrypted connection between a web server and a web browser. SSL certificates must be added to websites by businesses and organizations in order to safeguard online transactions and keep customer information private and secure.
-
By registering the SSLReloadBundle, you can have fresh certificate information reloaded during runtime, eliminating the need for a restart.
-
Send a POST request to SSL-reload to initiate a reload.
- When doing the reload, Dropwizard will utilize the same exact HTTPS configuration of keystore location, password, and so on.
Frequently Asked Questions
What exactly is a bundle in Dropwizard?
A Dropwizard Bundle is basically a reusable group of functionality that is often provided by the Dropwizard project itself, that is used to define blocks of activity in an application.
What is the purpose of Dropwizard?
Dropwizard is an open-source Java framework for creating high-performance RESTful web services quickly. It assembles several popular libraries to form a lightweight package. Its primary libraries are Jetty, Jersey, Jackson, JUnit, and Guava.
Dropwizard runs on which server?
Dropwizard embeds an extremely tuned HTTP server straight into your project using the Jetty HTTP framework.
Is Dropwizard free and open source?
Dropwizard is an open-source Java framework for creating high-performance, ops-friendly RESTful backends.
What is the definition of bootstrap in Dropwizard?
Bootstrap is the temporary application environment that contains everything needed to bootstrap a Dropwizard command.
Conclusion
In this article, we talked about what Dropwizard is and then moved forward to understand Dropwizard Bundles and its need. We then discussed how to initialize it and reuse it. We then discussed the serving assets and SSL reload and then had a look at some commonly asked questions. We hope that now you got an idea of how Dropwizard Bundles work.
If you want to know more about Dropwizard, refer to the following articles:
Please refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. And also, enroll in our courses and refer to the mock test and problems available. Have a look at the interview experiences and interview bundle for placement preparations.
Keep learning, Keep Growing!