I created a reproducible case for this, it took me some time to do this.
I kept digging a bit. It has to do with the fact that certain beans do not get a resolved name. In this screenshot you can see that for my bean xxx.NormalComponent the resolvedNames array is empty.
This array gets transformed into a map <String, Object> which is a map from all the resolved names to that bean. Since the array is empty, so is the map and UiControllerDependencyInjector.class:617 returns null.
The only question left is why the array of resolved names is empty.
It took me some experiments to actually be able to reproduce this as it is not trivial. I didn’t dig deeper as to why it is sometimes empty but I was able to reproduce it under different circumstances.
In my attached sample, I have created 4 screens and 4 beans. 3 out of the 4 beans can not be injected. It is a matter of slightly different variations.
*** disclaimer, my setup is very specific as you will see but I can imagine other (simpler) variants are possible, eg. DevelopmentException: can't find bean class ***
*** disclaimer 2, this behaviour might be a bug in Spring instead of Jmix ***
One key aspect is that in my examples, all of the beans implement an interface with a default method that is annotated @Async.
then every component can
- have a public method
- be annotated @Transactional
only the bean that has both a public method and is annotated @Transactional can be injected, the others fail. Looks like deriving the name for a bean is impacted by this.
application in attachment
reproduceBeanIssue.zip (197.4 KB)
Jmix version: 1.5.4
Jmix Studio plugin version: 2.1.1-233
IntelliJ version: IntelliJ IDEA 2023.3 (Ultimate Edition)