简体   繁体   中英

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.

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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