Hello Every One,
I have class A with constructor argument as (URI uri, Image image), where URI is java.net.URI and Image is java.awt.Image. I am trying to configure it via spring as:
But error is thrown as : Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDepen dencyException: Error creating bean with name 'a' defined in class path resource [/context.spring.xml]: Unsatisfied dependency expressed through constructor argument with index 1 of type [java.awt.Image]: Could not convert constructor argument value of type [java.lang.String] to required type [java.awt.Image]: Failed to convert value of type 'java.lang.String' to required type 'java.awt.Image'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.awt.Image]: no matching editors or conversion strategy found.Code:<bean id="a" class="some package"> <constructor-arg type="java.net.URI" value=""/> <constructor-arg type="java.awt.Image" value=""/>
But for image if I create another bean likeand change the above as :Code:<!--Abstract Class Image --> <bean id="image" class="java.awt.Image" abstract="true"/>
Then also I am getting errors.Code:<bean id="a" class="some package"> <constructor-arg type="java.net.URI" value=""/> <constructor-arg ref="image"/>
Please suggest.


Reply With Quote
