Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sisu-users] Contextual Injection - InjectionPoint

Hi,

I’m not adverse to supporting contextual injection if there was enough demand for it, but I think it should be used sparingly as it can lead to tightly-coupled code (where the injected and injectee know about each other).

Implementing such a feature would be straightforward (ProvisionListener+thread-local) and there’s existing scheduler code in the bean package that already deals with ProvisionListener which could be re-used/adapted.

My current focus is finishing the fine-grained OSGi integration, but if someone wants to propose an implementation via gerrit or bugzilla then I’d be happy to take a look.

-- 
Cheers, Stuart

On Thursday, 16 October 2014 at 10:03, gian.maria.romanato@xxxxxxxxxxxx wrote:

Hi,

the CDI specification provides an API that allows binding producers to be aware of the injection point and to make contextual injections http://docs.oracle.com/javaee/6/api/javax/enterprise/inject/spi/InjectionPoint.html

My understanding is that Guice does not offer anything like that out-of-the-box:
https://code.google.com/p/google-guice/issues/detail?id=27
https://code.google.com/p/google-guice/issues/detail?id=49

However, looks like it is possible to support contextual injection using the Guice SPI, and in fact there exists an open source project that provides a Guice extension to support contextual injections:
http://tavianator.com/2014/04/announcing-sangria/#more-1038
https://github.com/tavianator/sangria

Given that Sisu already supports some javax.enterprise.inject.* features, what is the Sisu authors' opinion about contextual injection? Will Sisu support it?

GianMaria.

_______________________________________________
sisu-users mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit


Back to the top