【发布时间】:2017-06-03 01:30:11
【问题描述】:
我的应用程序中定义了 REST FeignClient:
@FeignClient(name = "gateway", configuration = FeignAuthConfig.class)
public interface AccountsClient extends Accounts {
}
我在服务器和客户端之间共享端点接口:
@RequestMapping(API_PATH)
public interface Accounts {
@PostMapping(path = "/register",
produces = APPLICATION_JSON_VALUE,
consumes = APPLICATION_JSON_VALUE)
ResponseEntity<?> registerAccount(@RequestBody ManagedPassUserVM managedUserDTO)
throws EmailAlreadyInUseException, UsernameAlreadyInUseException, URISyntaxException;
}
除了我在客户端应用程序中的FeignClient 定义也被注册为独立的 REST 端点之外,一切正常。
目前,我尝试使用过滤器来防止这种行为,该过滤器在我的客户端应用程序中返回FeignClinet 客户端映射的404 状态代码。然而,这种工作环境似乎很不雅。
还有其他方法可以防止假装客户端注册为单独的 REST 端点吗?
【问题讨论】:
标签: spring-mvc spring-cloud spring-cloud-netflix netflix-feign spring-cloud-feign