-
Notifications
You must be signed in to change notification settings - Fork 353
Add support for FactoryBean that specify the target type using FactoryBean.OBJECT_TYPE_ATTRIBUTE #1155
Comments
Fixes spring-attic#1155 Related to spring-attic#1134 The `FactoryBean.OBJECT_TYPE_ATTRIBUTE` is crucial for those `FactoryBean` impls which does not expose the target type during compilation. * Add `FactoryBean.OBJECT_TYPE_ATTRIBUTE` as a candidate for the `DefaultBeanRegistrationWriter.getAttributeFilter()` since that one is `false` by default anyway * Rework `IntegrationApplication` to reflect the current Spring Boot state * Use `spring-integration-5.5.6-SNAPSHOT` for the latest bean definition changes over there The `build.sh -a` now passes for the integration sample. Cannot confirm in the native mode since GraalVM doesn't work well on Windows: too long command line. Need to build classpath file (jar with respective META-INF) somehow...
I didn't see this issue and commented on the PR instead #1172 (comment) Let's keep the conversation here please. I'd like to understand what bean definitions in Spring Integration require this. |
See the related issue: #1030. Perhaps that one is more generic than this one, so it might be considered as duplication. For more context. Spring Integration has a
But anyway this info is not available during autowiring. See the
Where that
Spring Integration scans for that interface and expose a Probably using a |
Thanks for the additional feedback. I don't think exposing the factory type in the generated code is the right way to fix this. After all, we have at build time a complete overview of the bean definitions and their state so we should be able to write back something that represents the correct state of the application context without relying on the context to do extra hops for us. I've been investigating a few options but they all have drawbacks. I'll investigate some more this week. |
Yes, I also had the same doubt about such an extra type info which is really available for us at build time. Thanks |
Fixes spring-attic#1155 Related to spring-attic#1134 The `FactoryBean.OBJECT_TYPE_ATTRIBUTE` is crucial for those `FactoryBean` impls which does not expose the target type during compilation. * Add `FactoryBean.OBJECT_TYPE_ATTRIBUTE` as a candidate for the `DefaultBeanRegistrationWriter.getAttributeFilter()` since that one is `false` by default anyway * Rework `IntegrationApplication` to reflect the current Spring Boot state * Use `spring-integration-5.5.6-SNAPSHOT` for the latest bean definition changes over there The `build.sh -a` now passes for the integration sample. Cannot confirm in the native mode since GraalVM doesn't work well on Windows: too long command line. Need to build classpath file (jar with respective META-INF) somehow...
I changed my mind and I added a dedicated writer for the case of a |
There are some use-cases when
FactoryBean
target type cannot be determined from generics or some other info duringbeanFactory.resolveDependency()
.For this purpose we rely on the
FactoryBean.OBJECT_TYPE_ATTRIBUTE
attribute setting onBeanDefinition
.Such an attribute should be copied to the target generated code.
This way we won't need to develop our own simple
BeanRegistrationWriter
just for a sake of this attribute carrying on.The text was updated successfully, but these errors were encountered: