public static void main(String[] args) {
VertxOptions vertxOptions = new VertxOptions();
Vertx vertx = Vertx.vertx(vertxOptions);
JsonArray jsonArray = new JsonArray();
jsonArray.add(MyEndpoint.class.getPackage().getName());
JsonArray jsonArray2 = new JsonArray();
jsonArray2.add(FilterBinder.class.getName());
vertx.runOnContext(aVoid -> {
// Set up the jersey configuration
// The minimum config required is a package to inspect for JAX-RS endpoints
vertx.getOrCreateContext().config()
.put("jersey", new JsonObject()
.put("port", 8080)
.put("packages", jsonArray)
.put("instances", jsonArray2));
// Use a service locator (HK2 or Guice are supported by default) to create the jersey server
ServiceLocator locator = ServiceLocatorUtilities.bind(
new HK2JerseyBinder(),
new HK2VertxBinder(vertx));
JerseyServer server = locator.getService(JerseyServer.class);
server.start();
});
}
This is how I add https://github.com/ef-labs/vertx-jersey/blob/develop/examples/filter/src/main/java/com/englishtown/vertx/jersey/examples/FilterBinder.java to my setup. Maybe it helps someone (it took me a while to figure out).