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

Activity

  1. mthmulders commented on Jul 7, 2021

    @mthmulders
    ContributorAuthor

    PS. If you feel this is indeed worth fixing, I am willing to give it a shot.

  2. danp11 commented on Jul 16, 2021

    @danp11

    Hi @artursouza

    I/we know you are super busy with the Dapr core development first and foremost.
    And maybe it is vacation times in the US aswell, so please don't get me wrong.

    But I do believe that for the Java SDK to be successful, there should me more maintainers
    of this SDK so we can have a quite active discussion on the issues. Just my two cents and I hope
    you can forward this to "the ones that decides about resources in the Dapr team at Microsoft" :-)

    Thank you for your contribution and support and the other Java SDK maintainers. It is/has been great!

    With hopes that you can get more help to maintain the Java SDK,

    /Dan

  3. added this to the v1.3 milestone on Aug 14, 2021
  4. tanvigour commented on Aug 26, 2021

    @tanvigour
    Contributor

    PR merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions