是否可以将Spring MVC与Jersey注释一起使用?

是否可以将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