Skip to content

Support @PathVariable in annotated message handling methods [SPR-10949] #15577

@spring-projects-issues

Description

@spring-projects-issues

nebhale opened SPR-10949 and commented

Currently if a method is annotated with @SubscribeEvent and then uses an @PathVariable the value is not mapped into the method invocation. So an example such as the following does not work.

@SubscribeEvent("/projects/{projectId}/builds")
List<Build> onSubscribe(@PathVariable String projectId) {
  ...
}

What should happen is the value that is extracted from the placeholder should be injected in the same way it would be if this were an @RequestMapping annotated method. Note that this means that the argument should be coerced beyond a mere String and should get the full benefit of the Spring's type coercion support (e.g, Spring Data's domain class binding). Also note that this may be more generally applicable to methods annotated with other types (e.g. @MessageMapping).


Affects: 4.0 M3

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions