You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.