camel-tooling / camel-tooling/camel-idea-plugin
@BeanInject - incorrectly marking bean as incompatible with specified type
- Dominant language
- Java
- Stars
- 210
- Forks
- 59
- Avg merge
- 6d 19h
- Merged PRs (30d)
- 6
Description
I've got a class, that for production code is of one type, but in tests it's implemented manually, so has different type.
In production code I inject it via some `Cache` interface, but in tests I inject it with the `TestCache` type, because I want to call some init / cleanup methods in tests. `@BeanInject` looks for the bean id and finds it in the production blueprint context, so it marks it as a specific type (e.g. `CaffeineCache`), and then proceeds to say that I can't inject the bean to my `TestCache` field.
Suggested solution - either look for all the beans (in production and in test code), and only mark the bean as incompatible if all of them do not match the field type; or even better, if there's a bean declared in both prod and test code, use the correct one for determining the type, based on whether I'm injecting it in prod or test class.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.