Skip to content

@ContextValue resolver cannot determine method parameter name on @BatchMapping methods #562

Closed
@philip-jvm

Description

@philip-jvm

Hello there

When @ContextValue#name is omitted within a @SchemaMapping method parameter.
The ContextValueMethodArgumentResolver#getContextValueName, will retrieve the context value based on the parameter.getParameterName().

@QueryMapping
public Client client(@ContextValue UUID integrationToken)  // Correctly injects the integrationToken context value

When @ContextValue#name is omitted within a @BatchMapping method parameter.
The ContextValueMethodArgumentResolver#getContextValueName parameter.getParameterName() returns null, and an exception is thrown. When @ContextValue#name is set, it is correctly injected.

@BatchMapping
public Callable<Map<Client, UUID>> advisorId(List<Client> clients,
                                                 @ContextValue("integrationToken") UUID integrationToken
                                                 // @ContextValue UUID integrationToken -> throws an exception 

Should @ContextValue be consistent between *Mapping annotations?

I have reproduced it here

Many thanks

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions