Skip to content

Fix NPE when a workflow implementation uses a composed @WorkflowImpl annotation - #3024

Open
muhrifqii wants to merge 2 commits into
temporalio:mainfrom
muhrifqii:worker-template-spring-annotation
Open

Fix NPE when a workflow implementation uses a composed @WorkflowImpl annotation#3024
muhrifqii wants to merge 2 commits into
temporalio:mainfrom
muhrifqii:worker-template-spring-annotation

Conversation

@muhrifqii

Copy link
Copy Markdown

What was changed

WorkersTemplate#configureWorkflowImplementationsByWorkerName now uses AnnotationUtils.findAnnotation instead of Class#getAnnotation to look up @WorkflowImpl.
Added AutoDiscoveryComposedAnnotationTest and a dedicated composedannotation fixture package that reproduce the bug with a user-defined composed annotation on both a workflow and an activity implementation.

Why?

If a workflow implementation class is annotated with a custom composed (meta) annotation, for example a user-defined annotation that is itself annotated with @WorkflowImpl, rather than @WorkflowImpl applied directly - worker auto-discovery threw an NPE.
Class#getAnnotation only resolves annotations present directly on the class, so it returned null, and the next line (annotation.workers()) NPE'd.

@ActivityImpl/@NexusServiceImpl lookups were already consistent throughout, which is why only workflows registered via workers() were affected.

Checklist

  1. Closes N/A - found while implementing temporal-spring-boot-autoconfigure in an application with a custom composed annotation.

  2. How was this tested:
    Added AutoDiscoveryComposedAnnotationTest, confirmed it reproduces the NPE before the fix and passes after
    Ran the full temporal-spring-boot-autoconfigure test suite; all tests pass.

  3. Any docs updates needed?
    No.

@muhrifqii
muhrifqii requested a review from a team as a code owner August 20, 2026 18:49
@CLAassistant

CLAassistant commented Aug 20, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants