MicroBean Jersey Container Grizzly2 HTTP CDI Extension

This is the eighth of a series of posts on some of the personal projects I’ve been working on.  As I hope you’ll see, they all fit together.  The previous post covered MicroBean Grizzly HTTP Server CDI Integration.  The next post covers MicroBean Maven CDI.

This post covers MicroBean Jersey Container Grizzly2 HTTP CDI Extension.  Its website is here, its source code is here and its binaries are available from Maven Central.

MicroBean Jersey Container Grizzly2 HTTP CDI Extension (another mouthful) uses MicroBean CDI Utilities and Jersey and Grizzly classes to provide an AbstractBlockingExtension that starts up a Jersey server on a configurable port inside a CDI container if an Application instance is found in the same CDI container.

To install MicroBean Jersey Container Grizzly2 HTTP CDI Extension, place it on your classpath.

MicroBean Jersey Container Grizzly2 HTTP CDI Extension does exactly nothing if there is not an HttpServer instance in the CDI container.  You can cause an HttpServer to exist in the CDI container in any way that you like.  One particularly useful way is to use MicroBean Jersey Container Grizzly HTTP CDI Integration (just place it, too, on your classpath).

If there is an HttpServer instance in the CDI container (or actually any number), then MicroBean Jersey Container Grizzly2 HTTP CDI Extension starts it in such a way that the CDI container is politely and legally blocked.  (I’ve written before on the topic of politely blocking the CDI container.)  See the documentation for the AbstractBlockingExtension class for more information.

The net effect of all this is that if you place the following projects on your classpath (and their minimal dependencies) together with your Application instance, you will have an executable Java SE CDI program serving your JAX-RS application on a port of your choosing via Jersey’s GrizzlyHttpServerFactory without having had to write any code other than that of your Application class:

The next post covers MicroBean Maven CDI.  I promise this will continue to be relevant, despite the Maven reference. 😀


Author: Laird Nelson

Devoted husband and father; working on Helidon at the intersection of Java, Jakarta EE, architecture, Kubernetes and microservices at Oracle; open source guy; Hammond B3 player and Bainbridge Islander.

2 thoughts on “MicroBean Jersey Container Grizzly2 HTTP CDI Extension”

Comments are closed.