是否可以将Spring MVC与Jersey注释一起使用? [英] Is it possible to use Spring MVC with Jersey annotations?

查看:221
本文介绍了是否可以将Spring MVC与Jersey注释一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,是否可以将Spring Web MVC与Jersey注释一起使用,因为我遇到了一个大问题,即Spring无法以Jersey的方式解析部分变量,我需要将一些Jersey代码迁移到Spring MVC.

I am wondering, if it's possible to use Spring Web MVC with Jersey annotations, as I'm having a massive problem with Spring not being able to parse part variables the way Jersey can and I need to migrate some Jersey code to Spring MVC.

我在泽西岛有以下代码:

I have the following code in Jersey:

@PUT
@Path("{storageId}/{repositoryId}/{path:.*}")
@PreAuthorize("hasAuthority('ARTIFACTS_DEPLOY')")
public Response upload(@PathParam("storageId") String storageId,
                       @PathParam("repositoryId") String repositoryId,
                       @PathParam("path") String path,
                       InputStream is)
{
    ...
}

我想将其转换为Spring MVC,但是,就像我在

I would like to convert this over to Spring MVC, but, like I've explained in this SO post, I'm experiencing issues with parsing the path variables.

因此,我想知道(和另一个问题):是否可以在Spring MVC中使用相同的Jersey注释?

Hence, my wondering (and a separate question): is it possible to use the same Jersey annotations with Spring MVC?

推荐答案

可以将Spring Web MVC与Jersey注释一起使用,请尝试在 Spring Initializer 那里,您可以检查选项jersey,查看spring如何构建此项目并尝试使用

it's possible to use Spring Web MVC with Jersey annotations, try make a little sample in Spring Initializer there you can check the option jersey, see how spring build this project and try in yours

这篇关于是否可以将Spring MVC与Jersey注释一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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