We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Given a data class like:
data class MyType(val key: String, val name: String)
a controller returning this type:
@RestController class MyController { @GetMapping("/my-type/{key}") fun getMyType(@PathVariable key: String): MyType { ... } }
a resource decorator:
@Component class MyTypeResourceDecorator : AbstractResourceDecorator<MyType>(MyType::class.java) { override fun links(myType: MyType, resourceContext: ResourceContext): List<Link> { return resourceContext.links() .self(on(MyTypeController::class.java).getMyType(myType.key)) } }
When tested, the call will fail because of:
Cannot subclass final class MyType
A current workaround is to adapt the controller to return a Resource instead:
Resource
@RestController class MyController { @GetMapping("/my-type/{key}") fun getMyType(@PathVariable key: String): Resource<MyType> { ... } }
The text was updated successfully, but these errors were encountered:
Other (and simpler) workaround, using an open instead of a data class:
open
data
open class MyType(val key: String, val name: String)
Of course, this is not very satisfying, but some fix might be available in a future Spring Kotlin extension - see https://github.com/sdeleuze/spring-kotlin
Sorry, something went wrong.
#625 Workaround for #532
7938b5f
#631 #532 Workaround
bb3b1eb
No branches or pull requests
Given a data class like:
a controller returning this type:
a resource decorator:
When tested, the call will fail because of:
A current workaround is to adapt the controller to return a
Resource
instead:The text was updated successfully, but these errors were encountered: