Skip to content

Pub/sub binding for Spring Boot ignores @PostMapping value #575

Description

@mthmulders

Expected Behavior

In my Spring Boot application, I have a @RestController annotated class with one method:

    @Topic(name = "speedingviolations", pubsubName = "pubsub")
    @PostMapping("/collectfine")
    public ResponseEntity<Void> registerViolation(@RequestBody final CloudEvent event) {
        // omitted for brevity
    }

I have added the io.dapr:dapr-sdk-springboot dependency, so I expect that this method will be invoked by the sidecar when a message is published on the "speedingviolations" topic.

Actual Behavior

The Dapr sidecar logs the following error:

ERRO[0031] non-retriable error returned from app while processing pub/sub event b411c8c6-e191-4853-b678-930c1183e4ab: {"timestamp":"2021-07-07T18:10:45.006+00:00","status":404,"error":"Not Found","path":"/speedingviolations"}. status code returned: 404  app_id=finecollectionservice instance=edsger scope=dapr.runtime type=log ver=1.2.2

The path "/speedingviolations" is not where the method is mapped to; the pub/sub message should be sent to "/collectfine".

Steps to Reproduce the Problem

See above. Crucial thing is that the @PostMapping annotation should use the value element rather than the path element.

Release Note

RELEASE NOTE: FIX Pub/sub binding for Spring Boot properly reads @PostMapping value

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions