简体   繁体   English

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

[英]Is it possible to use Spring MVC with Jersey annotations?

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. 我想知道,是否可以将Spring Web MVC与Jersey注释一起使用,因为我遇到了一个很大的问题,即Spring无法以Jersey的方式解析零件变量,我需要将一些Jersey代码迁移到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)
{
    ...
}

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,但是,正如我在本SO帖子中所解释的那样,我在解析路径变量时遇到问题。

Hence, my wondering (and a separate question): is it possible to use the same Jersey annotations with Spring MVC? 因此,我想知道(也是一个单独的问题):Spring MVC是否可以使用相同的Jersey注释?

可以使用带有Jersey批注的Spring Web MVC,尝试在Spring Initializer中创建一些示例,在那里您可以检查选项jersey,查看spring如何构建此项目并尝试使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM