Skip to content

Spring beans are not loaded in managed dependent resource #2166

Open
@rameshmalla

Description

@rameshmalla

Bug Report

What did you do?

I'm using josdk-spring-boot-starter to build an operator with a managed dependent resource, something similar to this example. When I inject a spring bean inside the dependent resource, on application startup I noticed that the spring beans were not instantiated and were always null. For example, in this demo application the operator fails due to NPE here

In a nutshell, the whole spring proxied dependent resource was ignored by the operator framework and instead created another instance of the dependent resource.

What did you expect to see?

The expectation from the framework is not to ignore spring proxied beans.

What did you see instead? Under which circumstances?

Spring beans are not instantiated.

Environment

Kubernetes cluster type: vanilla

$ Mention java-operator-sdk version from pom.xml file
Build file is here

implementation 'io.javaoperatorsdk:operator-framework-spring-boot-starter:5.0.0'
	annotationProcessor 'io.javaoperatorsdk:operator-framework:4.3.1'
	annotationProcessor 'io.fabric8:crd-generator-apt:6.5.1'

$ java -version 17

$ kubectl version

Possible Solution

Additional context

I have a demo application with the similar setup. The tests were failing because of the above mentioned issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions