Affects: 5.2.11.RELEASE, 5.3.6

Issue: If the bean is wrapped by aop (for example if it was marked with @Transactional somewhere) into a proxy AND signleton instance was precreated (injected into some @Autowired field) already then ListableBeanFactory.getBeansOfType will not find it.

What i am trying to achieve: I have a bunch of services implementations which all extend CrudService abstract generic class and I want find all implementations automatically.

Possible fix - change ResolvableType.isInstance(Object obj) implementation from: return (obj != null && isAssignableFrom(obj.getClass())); to: return (obj != null && isAssignableFrom(obj.getClass())) || (checkSomehowIsItAProxy(obj) && isInstance(getWrappedObjectSomehow(obj)));

Comment From: mettyoung

Following, this is still an issue ?

Comment From: snicoll

You should not use getBeansOfType in the first place. It's not available on the BeanFactory and that's what you should be using for that (not the ApplicationContext).

If BeanFactory#getBeanProvider does not work, please share a small sample we can run ourselves that reproduces that behavior.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.