javax.ws.rs.Produces 相当于 Spring

javax.ws.rs.Produces equivalent in Spring

org.springframework.web.bind.annotation 中是否有 @Produces(javax.ws.rs.core. MediaType.APPLICATION_JSON) 的等价注解以免混淆两者?正如我现在所做的...

@PostMapping("/price-menu")
    @Produces(javax.ws.rs.core. MediaType.APPLICATION_JSON)
    public ResponseEntity<Currency> menus 
            (HttpServletRequest request) {
..
}

@PostMapping 有一个名为 produces 的参数。 (https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/bind/annotation/PostMapping.html#produces--)

你可以这样使用它:@PostMapping(path = "/price-menu", consumes = "application/json", produces = "application/json")