Skip to content

Make @ControllerConfiguration Inherited #1347

Closed
@BramMeerten

Description

@BramMeerten

When you register a Reconciler, and the Reconciler has the @ControllerConfiguration on a superclass, an error will be thrown:

myOperator.register(new MyReconciler());

class MyReconciler extends MySuper { }

@ControllerConfiguration
class MySuper implements Reconciler<MyResource> {}

This is the code that throws the exception (AnnotationControllerConfiguration.java):

this.annotation = reconciler.getClass().getAnnotation(ControllerConfiguration.class);
    if (annotation == null) {
      throw new OperatorException(
          "Missing mandatory @" + ControllerConfiguration.class.getSimpleName() +
              " annotation for reconciler:  " + reconciler);
    }

Solution is to add @Inherited to @ControllerConfiguration.

I'd be willing to contribute this change, if this is an acceptable enhancement.

Reason why this is needed in my case
I'm using micronaut framework. And when I inject my reconciler, I actually inject a proxy class that is a subclass of my Reconciler implementation (because I'm using micronaut AOP).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions