Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to register custom predicates and filters for use in Server MVC configuration #3268

Closed
NiiazKhan opened this issue Feb 16, 2024 · 3 comments
Milestone

Comments

@NiiazKhan
Copy link

NiiazKhan commented Feb 16, 2024

For Spring Cloud Gateway MVC (without webFlux), an equivalent of AbstractGatewayFilterFactory (Gateway Reactive Server) is needed, which allows writing a custom filter and using it by specifying it in the YAML manifest, as shown in this StackOverflow question.

Currently, to use a custom filter, I am forced to write a @bean RouterFunction in Java.

Refer to the filter in Gateway Reactive Server here: Spring Cloud Gateway - Writing Custom GatewayFilter Factories.

@NiiazKhan NiiazKhan changed the title Spring Cloud Gateway MVC: using custom filter in the YAML manifest Spring Cloud Gateway MVC: using custom filter in the YAML Feb 16, 2024
@spencergibb
Copy link
Member

No abstract class is needed. What is, is the documentation on how to register predicates and filters for use in configuration rather than java dsl.

@spencergibb spencergibb changed the title Spring Cloud Gateway MVC: using custom filter in the YAML Document how to register custom predicates and filters for use in Server MVC configuration Mar 11, 2024
@spencergibb spencergibb added this to the 4.1.2 milestone Mar 11, 2024
@spencergibb
Copy link
Member

See

org.springframework.cloud.gateway.server.mvc.filter.FilterSupplier=\
org.springframework.cloud.gateway.server.mvc.filter.Bucket4jFilterFunctions.FilterSupplier,\
org.springframework.cloud.gateway.server.mvc.filter.CircuitBreakerFilterFunctions.FilterSupplier,\
org.springframework.cloud.gateway.server.mvc.filter.RetryFilterFunctions.FilterSupplier,\
org.springframework.cloud.gateway.server.mvc.filter.TokenRelayFilterFunctions.FilterSupplier,\
org.springframework.cloud.gateway.server.mvc.filter.FilterFunctions.FilterSupplier

and

org.springframework.cloud.gateway.server.mvc.predicate.PredicateSupplier=\
org.springframework.cloud.gateway.server.mvc.predicate.MvcPredicateSupplier,\
org.springframework.cloud.gateway.server.mvc.predicate.GatewayRequestPredicates.PredicateSupplier

for now

@spencergibb
Copy link
Member

Watch #3250 for a programmatic way to register.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants