Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make @ControllerConfiguration Inherited #1347

Closed
BramMeerten opened this issue Jul 18, 2022 · 2 comments · Fixed by #1352
Closed

Make @ControllerConfiguration Inherited #1347

BramMeerten opened this issue Jul 18, 2022 · 2 comments · Fixed by #1352
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@BramMeerten
Copy link
Contributor

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).

@BramMeerten
Copy link
Contributor Author

I'm not able to change the label as requested in the contribution guideline:

please also open an issue describing your feature and label it "enhancement"

@metacosm
Copy link
Collaborator

I think that's a good idea to add @Inherited. I would actually consider it a bug that it's not already done! 😄

@metacosm metacosm added the kind/bug Categorizes issue or PR as related to a bug. label Jul 18, 2022
BramMeerten pushed a commit to BramMeerten/java-operator-sdk that referenced this issue Jul 19, 2022
@csviri csviri linked a pull request Jul 19, 2022 that will close this issue
csviri pushed a commit that referenced this issue Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants