对于更复杂的需求,您可以创建类型的@Bean DiscoveryClientOptionalArgs并将ClientFilter实例注入其中, 所有这些都将应用于从客户端到 服务器
spring-cloud wiki中的这个描述
@Bean
public DiscoveryClientOptionalArgs discoveryClientOptionalArgs() {
DiscoveryClientOptionalArgs discoveryClientOptionalArgs = new DiscoveryClientOptionalArgs();
discoveryClientOptionalArgs.setAdditionalFilters(Collections.singletonList(new IpCilentFilter()));
return discoveryClientOptionalArgs;
}
public class IpCilentFilter extends ClientFilter {
@Override
public ClientResponse handle(ClientRequest clientRequest) throws ClientHandlerException {
// here How to disallow clients to connect
return getNext().handle(clientRequest);
}
}
如何禁止客户连接?
ClientHandlerException
无用的null
无用的我该怎么办?