I'm using Spring 5.3.22 with Boot 2.7.3. I've been doing some configuration refactoring using Spring Integration, and I made a change that is causing my application startup to fail with a BeanNotOfRequiredTypeException
; the bean is expected to be a MessageChannel
but is a proxy for my gateway business interface instead.
The error message for BeanNotOfRequiredTypeException
tells me what the expected and actual bean types are but not where the bean was trying to be injected. In my case, the problem is presumably that some dependent bean needs to be cleaned up so that has the correct expectation, but it's not clear which autowiring point caused the problem.
It would be useful for this case to identify the autowiring target when the failure occurred; perhaps AbstractAutowireCapableBeanFactory.createBean
could catch and wrap the exception with further context?
Comment From: snicoll
thanks for the suggestion but BeanNotOfRequiredTypeException
can be thrown in scenario that do not represent an autowiring target at all. For instance, the usual BeanFactory#getBean(String, Class<?>)
can throw it. I can see how doResolveDependencies
could provide a bit more context, perhaps with a dedicated exception.
Can you share a small sample that describe the problematic behavior you've described?
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.