Skip to content

Clarify expected behaviour around EntityLinks when using WebFlux #1080

Closed
@wilkinsona

Description

@wilkinsona

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]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions