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

Allow forward scheme for spring cloud gateway mvc similar to its webflux counterpart for declarative configuration using application properties or yaml #3188

Closed
mrinmoykhamrui opened this issue Dec 19, 2023 · 2 comments
Labels
Milestone

Comments

@mrinmoykhamrui
Copy link

Is your feature request related to a problem? Please describe.
webflux gateway allows forwarding using dispatcher handler (ForwardRoutingFilter) declaratively using application properties and yaml. Similar capability seems not available in mvc version of it.

Describe the solution you'd like
Ability to use forward scheme to configure gateway routes in application properties or yaml files. Any before filters applied on the request should be visible in the forwarded target

Describe alternatives you've considered
HandlerFunctions.forward is available for DSL based configuration however it seems any before filters applied on the request is not visible to the forward target.

@spencergibb
Copy link
Member

See HandlerFunctions.forward(). It should be available to configuration. Are you seeing otherwise?

@spencergibb
Copy link
Member

Caused by: java.lang.IllegalStateException: Unable to find HandlerFunction for scheme: forward
	at org.springframework.cloud.gateway.server.mvc.config.GatewayMvcPropertiesBeanDefinitionRegistrar.getRouterFunction(GatewayMvcPropertiesBeanDefinitionRegistrar.java:197) ~[classes/:na]
	at org.springframework.cloud.gateway.server.mvc.config.GatewayMvcPropertiesBeanDefinitionRegistrar.lambda$routerFunctionHolderSupplier$1(GatewayMvcPropertiesBeanDefinitionRegistrar.java:145) ~[classes/:na]
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na]
	at org.springframework.cloud.gateway.server.mvc.config.GatewayMvcPropertiesBeanDefinitionRegistrar.routerFunctionHolderSupplier(GatewayMvcPropertiesBeanDefinitionRegistrar.java:144) ~[classes/:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1257) ~[spring-beans-6.1.4.jar:6.1.4]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:951) ~[spring-beans-6.1.4.jar:6.1.4]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1217) ~[spring-beans-6.1.4.jar:6.1.4]
	... 120 common frames omitted

@spencergibb spencergibb added this to the 4.1.2 milestone Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants