SpringBlueprintConverterService$BlueprintConverterException with generics [message #1014480] |
Mon, 25 February 2013 17:35  |
Eclipse User |
|
|
|
Hello, I'm having an exception while trying to wire up some services using generics with Gemini Blueprint. I've created a simple sample bundle that demonstrates my problem. The Blueprint XML:
<bean id="subDatumDataSource" class="test.SimpleSubDatumDataSource"/>
<bean id="proxyDatumDataSource" class="test.ProxyDatumDataSource">
<argument ref="subDatumDataSource"/>
</bean>
where ProxyDatumDataSource is defined as
public class ProxyDatumDataSource<T extends Datum> implements DatumDataSource<T>
and SimpleSubDatumDataSource is defined as
public class SimpleSubDatumDataSource implements DatumDataSource<SubDatum>
and SubDatum is defined as
public interface SubDatum extends Datum
The resulting exception is:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'proxyDatumDataSource' defined in OSGi resource[bundleentry://85.fwk368471295/OSGI-INF/blueprint/module.xml|bnd.id=85|bnd.sym=reified-test]: Unsatisfied dependency expressed through constructor argument with index 0 of type [test.DatumDataSource]: Could not convert constructor argument value of type [test.SimpleSubDatumDataSource] to required type [test.DatumDataSource]: Failed to convert value of type 'test.SimpleSubDatumDataSource' to required type 'test.DatumDataSource'; nested exception is org.eclipse.gemini.blueprint.blueprint.container.SpringBlueprintConverterService$BlueprintConverterException: No conversion found for generic argument(s) for reified type interface test.Datum source type test.SimpleSubDatumDataSource| targetType =interface test.DatumDataSource
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:702)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:605)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:60)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:325)
at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:290)
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
It seems that since SimpleSubDatumDataSource implements DatumDataSource<SubDatum> instead of DatumDataSource<Datum> Gemini isn't able to perform the conversion? I tried using some different approaches, like a factory method, but I wasn't successful. Is this a bug, or can I work around this somehow?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05601 seconds