ef-labs / vertx-jersey

Run jersey in vert.x
MIT License
150 stars 47 forks source link

Easier setup of JerseyServer #58

Open jogardi opened 7 years ago

jogardi commented 7 years ago

The maven-simplest example used something like the following code to setup the Jersey Server.

    val locator = ServiceLocatorUtilities.bind(HK2JerseyBinder(), HK2VertxBinder(vertx),
                                                AutowiredBinder(appCtx))
    val server = locator.getService(JerseyServer::class.java)`

Since HK2VertxBinder is not in the vert-jersey artifact I had to add a bunch of dependencies and do some debugging in order to get it. I was thinking setup would be easier if there was a static factory method for DefaultJerseyServer. That way a JerseyServer could be instantiated with one line. I really like the flexibility of dependency injection so I think the method should have Binder... as a parameter.

I also think that there should be documentation of how we can directly access the ResourceConfig.

jogardi commented 7 years ago

Here is one way we could do it: https://gist.github.com/jgleoj23/8ad11e77a0aac1c80ac98f3a3d4f7081