-
Couldn't load subscription status.
- Fork 38.8k
Closed as not planned
Closed as not planned
Copy link
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
<bean id="someProxyServerBuilder" class="org.asynchttpclient.proxy.ProxyServer.Builder">
<property name="realm">
<bean factory-bean="someRealmBuilder" factory-method="build"/>
</property>
</bean>
<bean id="someRealmBuilder" class="org.asynchttpclient.Realm.Builder">
</bean>This configuration works successfully in Spring 5.x, but fails with Spring 6.x with the following error:
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.asynchttpclient.Realm' to required type 'org.asynchttpclient.Realm$Builder' for property 'realm'; Cannot convert value of type 'org.asynchttpclient.Realm' to required type 'org.asynchttpclient.Realm$Builder' for property 'realm': no matching editors or conversion strategy found
at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:594)
at org.springframework.beans.AbstractNestablePropertyAccessor.convertForProperty(AbstractNestablePropertyAccessor.java:608)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:190)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1728)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1685)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1429)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
... 107 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type 'org.asynchttpclient.Realm' to required type 'org.asynchttpclient.Realm$Builder' for property 'realm': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:260)
at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:589)
... 113 more
The complexity comes from the fact that org.asynchttpclient.proxy.ProxyServer.Builder#setRealm is overloaded, and there are two versions—one accepting Realm and another accepting Realm$Builder.
The following code in BeanWrapperImpl seems like it's not considering there may be several property descriptors for the same name:
PropertyDescriptor pd = cachedIntrospectionResults.getPropertyDescriptor(propertyName);What makes the matter worse, looks like the behavior is not deterministic. In different environments Spring will try to use different setters.
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid