MicroBean Jersey Container Grizzly HTTP CDI Integration

This is the sixth 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 Main.  The next post will cover MicroBean Grizzly HTTP Server CDI Integration.

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

MicroBean Jersey Container Grizzly HTTP CDI Integration (what a mouthful) provides CDI producer methods that produce two things:

Jersey’s GrizzlyHttpServerFactory uses a GrizzlyHttpContainer to build an HttpServer.  A GrizzlyHttpContainer can be produced by a ContainerFactory if it is supplied with GrizzlyHttpContainer.class and an Application.

To install MicroBean Jersey Container Grizzly HTTP CDI Integration, place it on the classpath.

By itself, this project doesn’t do much.  As mentioned, it installs some producer methods that integrate some Jersey and Grizzly raw materials, but they themselves don’t do anything unless someone else asks for, say, an HttpServer or a GrizzlyHttpContainer.  You are not likely to ask for these things directly in your own code (via @Inject).  And even if you do, you won’t get anything useful unless you have also placed an Application bean into the same CDI environment.

So merely placing this project on the classpath won’t do anything.

But when it is combined with MicroBean Jersey Container Grizzly2 HTTP CDI Extension, the subject of the next post, things get more interesting.  Specifically, as we’ll see, this combination allows you to simply supply an Application, and thanks to the interaction of MicroBean Jersey Container Grizzly2 HTTP CDI ExtensionMicroBean Jersey Container Grizzly HTTP CDI Integration, MicroBean Grizzly HTTP Server CDI IntegrationMicroBean CDI UtilitiesMicroBean Configuration CDIMicroBean ConfigurationMicroBean Main and MicroBean Configuration API, you can have a Jersey server running on a configured port as part of a CDI container started by a public static void main(String[]) method you didn’t write, simply by placing projects on the classpath.  I’ve written previously on this topic.

(I told you this would all start coming together.)

In the next post, we’ll look at MicroBean Grizzly HTTP Server CDI Integration, another supplier of raw materials for running Jersey inside CDI.

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 Grizzly HTTP CDI Integration”

Comments are closed.