aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <ch0...@gmail.com>
Subject Inject constructor using Blueprint
Date Tue, 25 Jun 2013 06:15:29 GMT
Hi,

Aries Blueprint project allows to inject constructors parameters using
BeanArgumentImpl. Here is an example of such usage :

        BeanMetadataImpl beanMetadata = (BeanMetadataImpl)
context.createMetadata(BeanMetadata.class);
        beanMetadata.setClassName("org.mycompany.MyFactoryBean");
        beanMetadata.setFactoryMethod("doSomething");
        beanMetadata.setId(id);

        BeanArgumentImpl argument = new BeanArgumentImpl();
        argument.setIndex(0);
        argument.setValue(createValue(context, id));
        beanMetadata.addArgument(argument);

Unfortunately, with release 1.0 of Apache Blueprint, this class has been
packaged with blueprint - parser which is a jar and not a bundle and even
if I use wrap to generate a bundle, it cannot be used as such as we get on
Apache Karaf a classcast exception

java.lang.ClassCastException:
org.apache.aries.blueprint.reflect.BeanMetadataImpl cannot be cast to
org.apache.aries.blueprint.reflect.BeanMetadataImpl
at
org.kie.aries.blueprint.namespace.ReleaseIdElementParser.parseElement(ReleaseIdElementParser.java:47)[120:org.kie.aries.blueprint:6.0.0.20130624-2122]

Question : How can we inject constructors parameters with Aries Blueprint
1.0 without using classes packaged under blueprint-parser ?

Regards,

-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message