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.

Advertisements

2 thoughts on “MicroBean Jersey Container Grizzly HTTP CDI Integration

  1. Pingback: MicroBean Main | Blame Laird

  2. Pingback: MicroBean Grizzly HTTP Server CDI Integration | Blame Laird

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s