【发布时间】:2020-07-09 04:35:51
【问题描述】:
我已经定义了一个 ApiController 来添加前缀 (/api) 来匹配路由。我正在使用 Spring Boot
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@RestController
@RequestMapping("/api")
public @interface ApiController {
@AliasFor(annotation = RequestMapping.class, attribute = "value")
String[] value();
}
并在控制器中使用,如
@ApiController("/user")
public class UserController {
/**
* Define url methods
*
*/
}
但我不知道为什么 /api/user/ 不提供服务。它服务于 /user/ 端点。有谁知道具体的错误吗?
【问题讨论】:
标签: java spring-boot spring-mvc