How to use Jersey 2 with Spring IoC container

前端 未结 3 1271
遇见更好的自我
遇见更好的自我 2020-12-28 19:37

What is the best way to enable injection of spring beans into Jersey 2? Jersey seems to not support this natively.

What is needed to wire the 2 frameworks together?

3条回答
  •  囚心锁ツ
    2020-12-28 20:14

    As of June 2013, Jersey 2.0 has no official Spring support. There are two options:

    1. Use third party code from here https://github.com/marko-asplund/jersey/tree/master/ext/jersey-spring
    2. Wait until HK2 spring bridge becomes stable and documented https://java.net/jira/browse/HK2-40

    See also:

    http://jersey.576304.n2.nabble.com/Spring-framework-support-for-Jersey-2-td7580673.html

    EDIT: Jersey 2.3 has spring support now, see the answer by Fabio below

提交回复
热议问题