【发布时间】:2020-03-17 08:08:43
【问题描述】:
我正在对在Jetty 上以Spring 运行的遗留单体应用程序进行现代化改造并将其转换为Spring Boot 应用程序。
在旧代码中,我有一个如下所示的端点:
@POST
@Produces({MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_JSON})
@Path("/zoo/feedCats")
@WebMethod
public Response giveFood( @Context UriInfo uri, HungryCats hungryCats){...}
Spring Boot 中新端点的初稿如下所示:
@PostMapping("/zoo/feedCats")
public Response giveFood( UriInfo uri , @RequestBody HungryCats hungryCats) {...}
我不确定旧代码中 @Context UriInfo uri 的正确替换是什么。
我找到了 2016 年的 this post,想知道是否还有其他用途?
【问题讨论】:
-
我不熟悉泽西岛,但this may be what you are looking for。
标签: java spring spring-boot servlets