Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sisu-users] enforcing component scope nesting

You might be able to use a ProvisionListener to do this as it gives access to the dependency chain leading up to each injection as well as the binding (which includes the scope)

http://google.github.io/guice/api-docs/latest/javadoc/index.html?com/google/inject/spi/ProvisionListenerBinding.html

-- 
Cheers, Stuart

On Monday, 9 February 2015 at 13:01, Igor Fedorenko wrote:

In Maven, there are several relatively clearly nested component scopes
that have different lifespan. There are components that can last as long
as Maven runtime instance is running, there are components that are
created and disposed of together with MavenProject instances (think of
Maven plugins) and there are also components with lifespan of individual
mojo executions.

Direct injection of components from shorter-lived scopes into components
from longer-lived scopes is not desirable (or outright wrong?) but from
what I can tell is currently allowed.

I am looking for a way to detect and report such injections. Some sort
of listener that gets notified whenever @Inject Component or
@Requirement Component is injected so the listener can analyze
classloaders of source and target components to decide if the injection
is legal or not. Is there anything is Sisu or Guice to do this?

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


Back to the top