Hi Lukasz, the CDI-way to implement this would be to write an Extension. The Extension could wrap the AnnotatedType and add an @Inject to the method setCamelContext.
Regards, Arne -----Ursprüngliche Nachricht----- Von: Łukasz Dywicki [mailto:l...@code-house.org] Gesendet: Mittwoch, 27. Juni 2012 10:36 An: deltaspike-users@incubator.apache.org; Mark Struberg Betreff: Re: Spring style *ContextAware beans Hey, It's related to injection. For example: class MyRouteBuilder implements InitializingBean, CamelContextAware { private CamelContext context; public void setCamelContext(CamelContext ctx) { this.context = ctx; } public void afterPropertiesSet() { if (this.context == null) { throw new IllegalStateException("Context must be set"); // do something } // other methods } MyRouteBuilder have two behaviors defined by implements closures. It's really simple to have the same effect with @PostConstruct and @Inject annotations, but - this is some kind of legacy code shared between different containers - Spring / OSGi Blueprint. Both of them have similar lifecycle like CDI and offer hooks to process beans before and after initialization. In this case I need to find all CamelContextAware beans before initialization and inject camel context without direct @Inject declarations (create injection targets?). Best regards, Lukasz Wiadomość napisana przez Mark Struberg w dniu 27 cze 2012, o godz. 01:47: > > > Hi Lukasz! > > Please elaborate a bite more about this functionality! > > LieGrue, > strub > > > >> ________________________________ >> From: Łukasz Dywicki <l...@code-house.org> >> To: deltaspike-users@incubator.apache.org >> Sent: Tuesday, June 26, 2012 9:16 PM >> Subject: Spring style *ContextAware beans >> >> Hey, >> I try to extend support for CDI in Apache Camel and I came to an problem - I >> don't know how to handle a CamelContextAware beans. CamelContextAware is >> some kind of marker interface and it means that POJO is interested in >> getting an instance of CamelContext. Typically it is implemented as spring >> bean post processor. How I could achieve something similar with CDI? >> >> Best regards, >> Lukasz Dywicki >> -- >> Code-House >> http://code-house.org >> >> >> >>