Skip to content

SDA Commons Server Weld

javadoc

sda-commons-server-weld is used to bootstrap Dropwizard applications inside a Weld-SE container and provides CDI support for servlets, listeners and resources. It allows to inject the application class or instances produced by the application class.

Info: We at SDA SE do not use CDI in our microservices anymore. We believe that dependency injection is not helpful for small services. Therefore, this module is not actively maintained by SDA SE developers. Automated security upgrades are enabled. Contributions of new features and bug fixes are welcome.

Usage

Application Bootstrap

To bootstrap a Dropwizard application inside a Weld-SE container, use the DropwizardWeldHelper:

1
2
3
public static void main(final String[]args) throws Exception {
    DropwizardWeldHelper.run(MyApplication.class, args);
}

Provided Bundles

To optionally use CDI support inside of servlets, use the additional WeldBundle:

1
2
3
public void initialize(final Bootstrap<AppConfiguration> bootstrap) {
    bootstrap.addBundle(new WeldBundle());
}

Testing

See sda-commons-server-weld-testing.