Binding POJO attributes as matrix variable in Feign Client URL Pattern

18 views Asked by At

I have a set of data which needs to be passed as MatrixVariable.

@PostMapping("{type};{metadata}/ctx/{id}")
    fun save(
        @RequestBody("entity") entity: T
        @PathVariable("type") type: String,
        @PathVariable("id") id: String,
        @MatrixVariable("metadata") metadata: Metadata)

Metadata class looks like this:

data class Metadata(
    val aId: String,
    val bId: String
)

The PathVariable resolve in the URL however the MatrixVariable doesn't.

Is only String & Map types are supported for MatrixVariable?

Following implementation generate correct URL

  @PostMapping("{type};aId={metadata.aId};bId={metadata.bId};/ctx/{id}")
    fun save(
        @RequestBody("entity") entity: T
        @PathVariable("type") type: String,
        @PathVariable("id") id: String,
        @PathVariable("aId") aId: String,
        @PathVariable("bId") bId: String)
0

There are 0 answers