Skip to content

Example project demonstrating Guice integration with new Jersey versions

Notifications You must be signed in to change notification settings

scottrobey/jersey-guice-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jersey-guice-integration

Example project demonstrating Guice integration with new Jersey versions

Using Jersey Docs and Examples: https://github.com/jersey/jersey/tree/master/examples

Jersey has built-in support for Guice in most recent versions, via the GuiceBridge and GuiceIntoHK2Bridge, as described here: https://javaee.github.io/hk2/guice-bridge.html The problem is that for projects that want to delegate dependency injection to Guice completely, it's not obvious where to boot-strap the Jersey container to plug-in the Guice injector. This project uses a Jersey ComponentProvider as the entry point to register the Guice Injector with the Jersey InjectionManager. The ComponentProvider should be registered via a file in the classpath: /META-INF/services/org.glassfish.jersey.server.spi.ComponentProvider

Note: I tried, unsuccessfully, to register the ComponentProvider via ResourceConfig.register() method, but received warnings stating that the class: "does not implement any provider interfaces applicable in the SERVER runtime"

Documentation for Jersey-Jetty integration and ComponentProvider: https://jersey.github.io/documentation/latest/deployment.html

References:

Guice:

About

Example project demonstrating Guice integration with new Jersey versions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages