java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [authorization.AuthorizationDelegate] for property 'delegate': no matching editors or conversion strategy found

Spring JIRA | Dan Turkenkopf | 8 years ago
  1. 0

    When PropertyOverrideConfigurer attempts to override a property that is a bean reference, it appears to replace with a String rather than following the bean reference. I have a jar with an embedded application-context.xml that configures a default delegate for the authorizationChecker bean. In the application that uses that jar, I'd like to override that default. The base application-context.xml: ====================================== <bean id="authorizationChecker" class="authorization.AuthorizationChecker"> <property name="order" value="100"/> <property name="delegate" ref="authorizationDelegate" /> </bean> <bean id="authorizationDelegate" class="authorization.NoAccessAuthorizationDelegate"> </bean> <bean id="databaseAuthorizationDelegate" class="authorization.DatabaseAuthorizationDelegate"> <property name="dao" ref="authorizationDao" /> </bean> ==================================== The application specific application-context.xml (uses PropertyOverrideConfigurer) ==================================== <bean class='org.springframework.beans.factory.config.PropertyOverrideConfigurer'> <property name='properties'> <props> <prop key='authorizationChecker.delegate'> databaseAuthorizationDelegate </prop> </props> </property> </bean> ==================================== Trying to start the application, I run into this exception: ==================================== java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [authorization.AuthorizationDelegate] for property 'delegate': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:219) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1287) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1248) ==================================== If I do the same thing but use a PropertyPlaceholderConfigurer and don't specify a default in the jar-enclosed definition, everything seems to work. Looking at the source, it looks like PropertyPlaceholderConfigurer uses a BeanDefinitionVisitor to resolve the runtime bean references, but the PropertyOverrideConfigurer stores the String value as a property rather than resolving it into a bean reference, even if it's originally defined as a ref.

    Spring JIRA | 8 years ago | Dan Turkenkopf
    java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [authorization.AuthorizationDelegate] for property 'delegate': no matching editors or conversion strategy found
  2. 0

    When PropertyOverrideConfigurer attempts to override a property that is a bean reference, it appears to replace with a String rather than following the bean reference. I have a jar with an embedded application-context.xml that configures a default delegate for the authorizationChecker bean. In the application that uses that jar, I'd like to override that default. The base application-context.xml: ====================================== <bean id="authorizationChecker" class="authorization.AuthorizationChecker"> <property name="order" value="100"/> <property name="delegate" ref="authorizationDelegate" /> </bean> <bean id="authorizationDelegate" class="authorization.NoAccessAuthorizationDelegate"> </bean> <bean id="databaseAuthorizationDelegate" class="authorization.DatabaseAuthorizationDelegate"> <property name="dao" ref="authorizationDao" /> </bean> ==================================== The application specific application-context.xml (uses PropertyOverrideConfigurer) ==================================== <bean class='org.springframework.beans.factory.config.PropertyOverrideConfigurer'> <property name='properties'> <props> <prop key='authorizationChecker.delegate'> databaseAuthorizationDelegate </prop> </props> </property> </bean> ==================================== Trying to start the application, I run into this exception: ==================================== java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [authorization.AuthorizationDelegate] for property 'delegate': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:219) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1287) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1248) ==================================== If I do the same thing but use a PropertyPlaceholderConfigurer and don't specify a default in the jar-enclosed definition, everything seems to work. Looking at the source, it looks like PropertyPlaceholderConfigurer uses a BeanDefinitionVisitor to resolve the runtime bean references, but the PropertyOverrideConfigurer stores the String value as a property rather than resolving it into a bean reference, even if it's originally defined as a ref.

    Spring JIRA | 8 years ago | Dan Turkenkopf
    java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [authorization.AuthorizationDelegate] for property 'delegate': no matching editors or conversion strategy found
  3. 0

    Service bean creation fails when bundle is refreshed

    Google Groups | 9 years ago | spock
    java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy13] to required type [com.insight.bo.OrderBO] for property 'orderBO': no matching editors or conversion strategy found
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Failed to convert property value of type[il.siqee.common.logging.custom.CustomLogger] to required type [il.siqee.common.logging.custom.CustomLogger]

    Stack Overflow | 1 year ago | Justin
    java.lang.IllegalArgumentException: Cannot convert value of type [il.siqee.common.logging.custom.CustomLogger] to required type [il.siqee.common.logging.custom.CustomLogger] for property 'customLogger': no matching editors or conversion strategy found
  6. 0

    Jenkins Update Version 1.580 vers 1.581 — EjnTricks

    jouvinio.net | 11 months ago
    java.lang.IllegalArgumentException: Manager password must not be empty or null.

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Cannot convert value of type [java.lang.String] to required type [authorization.AuthorizationDelegate] for property 'delegate': no matching editors or conversion strategy found

      at org.springframework.beans.TypeConverterDelegate.convertIfNecessary()
    2. Spring Beans
      AbstractAutowireCapableBeanFactory.applyPropertyValues
      1. org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:219)
      2. org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
      3. org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
      4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1287)
      5. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1248)
      5 frames