如何在Spring IoC容器中使用Jersey 2 [英] How to use Jersey 2 with Spring IoC container

查看:102
本文介绍了如何在Spring IoC容器中使用Jersey 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将春豆注射到Jersey 2中的最佳方法是什么?泽西(Jersey)似乎不支持此功能.

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

将这两个框架连接在一起需要做什么?在pom.xml和web.xml中?

What is needed to wire the 2 frameworks together? In pom.xml and web.xml?

推荐答案

您应该能够注释球衣组件,然后使用注释来注入bean.

You should be able to annotate jersey components and then use annotations to inject the beans.

@Service //(or @Component)
public class MyJerseyService {

    @Autowired
    private MyObj mySpringBean

}

这篇关于如何在Spring IoC容器中使用Jersey 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆