Spring cloud gateway has many GatewayFilters like AddRequestHeader、SecureHeaders,use configure file like application.yaml is easy to use,but how use this GatewayFilters in java code?
spring:
cloud:
gateway:
routes:
- id: route-1
uri: http://localhost1:5230
predicates:
- Path=/api/**
filters:
- SecureHeaders
Current I use the follow code to configure
route("route-1", predicateSpec -> predicateSpec.path("/api/**")
.uri("http://localhost:5230")
.filter(new SecureHeadersGatewayFilterFactory(new SecureHeadersProperties()).apply(new Object())))
Has more better solution?