我使用嵌入式服务器Grizzly,所以我没有web.xml。 如何将Google Guice添加到Jersey?
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
<version>2.23.2</version>
</dependency>
public static void main(String[] args) {
// ...
URI baseUri = UriBuilder.fromUri("http://localhost/").port(9998).build();
ResourceConfig config = new ResourceConfig();
config.packages("some.package");
HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, config, false);
server.start();
}