-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Allow registering custom filters and predicates in programmatic way (not spring.factories) #3250
Comments
Registering |
Requiring annotations or interface extensions is also fine by me. I just want to avoid writing a |
Is it somehow possible to add Before/After filters via spring.factories? It seems the "out-of-the-box" filters from SCG-mvc are using a wrapper class which is registered as full filters, with just one-liners that call the Before/After filter. Could do that for mine as well like this, but a more convient way as we had in the reactive gateway would be more comfortable. |
Could |
@ciscoo maybe. I'd have to do some design before I start looking at this feature. |
According to the documentation, if you want to use a custom filter for your route you have to publish a
RouterFunction
bean with the specified filter, with no alternatives if you want to configure the routing via properties. By contrast, in the reactive version of gateway you can publish aGatewayFilterFactory
and reference the filter in your properties. It would be useful to be able to do the same withHandlerFilterFunction
s.At the moment the only way to do this is to create a
FilterSupplier
for your filters and reference it in aspring.factories
file. Registering theFilterSupplier
as bean does not work, sinceGatewayMvcPropertiesBeanDefinitionRegistrar
does not perform any bean resolution, instead it delegates to theFilterDiscoverer
which in turns usesSpringFactoriesLoader.loadFactories
. While this works fine, it's cumbersome and it would be greatly simplified if you could directly publish the filters.The text was updated successfully, but these errors were encountered: