Jersey 2.0 w/ Guice

This library adds support for Jersey 2.0 w/ Guice

Лицензия

Лицензия

Категории

Категории

GUI Взаимодействие с пользователем Guice Библиотеки уровня приложения Dependency Injection Square Прикладные библиотеки Financial Jersey Межпрограммное взаимодействие REST Frameworks
Группа

Группа

com.squarespace.jersey2-guice
Идентификатор

Идентификатор

jersey2-guice-impl
Последняя версия

Последняя версия

1.0.6
Дата

Дата

Тип

Тип

jar
Описание

Описание

Jersey 2.0 w/ Guice
This library adds support for Jersey 2.0 w/ Guice
Ссылка на сайт

Ссылка на сайт

https://github.com/Squarespace/jersey2-guice
Система контроля версий

Система контроля версий

https://github.com/Squarespace/jersey2-guice

Скачать jersey2-guice-impl

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.squarespace.jersey2-guice/jersey2-guice-impl/ -->
<dependency>
    <groupId>com.squarespace.jersey2-guice</groupId>
    <artifactId>jersey2-guice-impl</artifactId>
    <version>1.0.6</version>
</dependency>
// https://jarcasting.com/artifacts/com.squarespace.jersey2-guice/jersey2-guice-impl/
implementation 'com.squarespace.jersey2-guice:jersey2-guice-impl:1.0.6'
// https://jarcasting.com/artifacts/com.squarespace.jersey2-guice/jersey2-guice-impl/
implementation ("com.squarespace.jersey2-guice:jersey2-guice-impl:1.0.6")
'com.squarespace.jersey2-guice:jersey2-guice-impl:jar:1.0.6'
<dependency org="com.squarespace.jersey2-guice" name="jersey2-guice-impl" rev="1.0.6">
  <artifact name="jersey2-guice-impl" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.squarespace.jersey2-guice', module='jersey2-guice-impl', version='1.0.6')
)
libraryDependencies += "com.squarespace.jersey2-guice" % "jersey2-guice-impl" % "1.0.6"
[com.squarespace.jersey2-guice/jersey2-guice-impl "1.0.6"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
com.google.inject.extensions : guice-multibindings jar 4.0
com.google.inject.extensions : guice-servlet jar 4.0
org.glassfish.jersey.containers : jersey-container-servlet-core jar 2.22.2
com.squarespace.jersey2-guice : 0-jersey2-guice-spi jar 1.0.6
com.google.code.findbugs : jsr305 jar 3.0.1
org.slf4j : slf4j-api jar 1.7.16

test (3)

Идентификатор библиотеки Тип Версия
org.testng : testng jar 6.9.10
org.eclipse.jetty : jetty-servlet jar 9.2.9.v20150224
org.glassfish.jersey.containers : jersey-container-servlet jar 2.22.2

Модули Проекта

Данный проект не имеет модулей.

Jersey 2.0 w/ Guice

Continuous Integration

Introduction

This library provides support for Jersey 2.0 w/ Guice similar to the way it used to work in Jersey 1.x with the jersey-guice library. It uses Guice's own GuiceFilter (like jersey-guice) and it's somewhat different from the Guice/HK2 Bridge.

Installation

Go to search.maven.org and search for g:"com.squarespace.jersey2-guice" AND a:"jersey2-guice-impl" to find the current release version.

Gradle

compile "com.squarespace.jersey2-guice:jersey2-guice-impl:${current.version}"

Maven

<dependency>
  <groupId>com.squarespace.jersey2-guice</groupId>
  <artifactId>jersey2-guice-impl</artifactId>
  <version>${current.version}</version>
</dependency>

Usage

Getting Started

Jersey/HK2 uses unfortunately SPIs and the Singleton pattern internally. Your code is effectively racing against the Servlet container's code and the first one to initialize HK2's ServiceLocatorGenerator inside its ServiceLocatorFactory wins.

This library uses two approaches to override HK2's own ServiceLocatorGenerator. It first tries to use a SPI and if it can't it'll fall back to reflection to replace a private static field. Regardless of the approach it's still a race against the Servlet container.

public static void main(String[] args) {

  List<Module> modules = new ArrayList<>();
  
  modules.add(new JerseyGuiceModule("__HK2_Generated_0"));
  modules.add(new ServletModule());
  modules.add(new AbstractModule() {
    @Override
    protected void configure() {
      // ...
    }
  });
  
  Injector injector = Guice.createInjector(modules);
  JerseyGuiceUtils.install(injector);
  
  // ... continue ...
}

Documentation

The User's Guide can be found in the Wiki.

Apache 2.0 License

Copyright 2014-2016 Squarespace, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
com.squarespace.jersey2-guice

Squarespace

Версии библиотеки

Версия
1.0.6