Skip to content

Clarify expected behaviour around EntityLinks when using WebFlux #1080

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

Closed
wilkinsona opened this issue Sep 17, 2019 · 2 comments
Closed

Clarify expected behaviour around EntityLinks when using WebFlux #1080

wilkinsona opened this issue Sep 17, 2019 · 2 comments
Assignees
Labels
Milestone

Comments

@wilkinsona
Copy link
Member

wilkinsona commented Sep 17, 2019

Thanks for the updates made for #1062, but I am still finding the documentation confusing as it seems to contradict itself.

In section 3.5, when talking about EntityLinks implementations it states that the "most fundamental one is ControllerEntityLinks that inspects SpringMVC and Spring WebFlux controller classes". Section 3.5.1 continues in the same vein. These sections are contradicted by section 3.5.3 where the update for #1062 means that the documentation now states that "EntityLinks and it’s various implementations are NOT currently provided out-of-the-box for Spring WebFlux applications".

Looking at the runtime behaviour, it seems to disagree with both of the documentation's opinions. Contrary to the update made for #1062, an EntityLinks instance is provided out-of-the-box when using Spring WebFlux applications and is available for dependency injection. However, when an attempt is made to use it in an @ExposesResourceFor-annotated controller, it fails:

java.lang.IllegalArgumentException: Cannot determine link for smoketest.hateoas.webflux.domain.Customer! No EntityLinks instance found supporting the domain type!
	at org.springframework.hateoas.server.core.DelegatingEntityLinks.lambda$getPluginFor$0(DelegatingEntityLinks.java:101) ~[spring-hateoas-1.0.0.GH1077-SNAPSHOT.jar:1.0.0.GH1077-SNAPSHOT]
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
	|_ checkpoint ⇢ org.springframework.web.filter.reactive.ServerWebExchangeContextFilter [DefaultWebFilterChain]
	|_ checkpoint ⇢ HTTP GET "/customers/1" [ExceptionHandlingWebHandler]
@odrotbohm
Copy link
Member

Good catch, Andy. Looks like the inconsistency stems from the different stages of docs refactoring we did. I'll remove all references to WebFlux from these sections and add a not in the intro of the section that WebFlux is currently not supported.

@odrotbohm odrotbohm self-assigned this Sep 26, 2019
@odrotbohm odrotbohm added this to the 1.0.0.RELEASE milestone Sep 26, 2019
odrotbohm added a commit that referenced this issue Sep 26, 2019
We now explicitly only enable EntityLinks in WebMVC environments. This is also now reflected properly in the reference documentation.
@odrotbohm
Copy link
Member

I've also tweaked the configuration to only activate EntityLinks for WebMVC scenarios. We'll revisit the WebFlux support for 1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants