You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Kristian Rosenvold <kr...@gmail.com> on 2014/01/08 21:03:30 UTC

Inject from multiple interfaces in plexus ?

With spring, you can say:

@Component
class X implements Y,Z

And at call site:

@Inject
private Y y;

@Inject
private Z z;

And expect (scope dependent) to get the same instance of X in both y and z.

Can I achieve this in m3.2 core ?

Kristian

Re: Inject from multiple interfaces in plexus ?

Posted by Stuart McCulloch <mc...@gmail.com>.
On 8 Jan 2014, at 20:03, Kristian Rosenvold <kr...@gmail.com> wrote:

> With spring, you can say:
> 
> @Component
> class X implements Y,Z
> 
> And at call site:
> 
> @Inject
> private Y y;
> 
> @Inject
> private Z z;
> 
> And expect (scope dependent) to get the same instance of X in both y and z.
> 
> Can I achieve this in m3.2 core ?

Yes, but you’d need to use JSR330 @Named instead of Plexus @Component:

	http://wiki.eclipse.org/Sisu/PlexusMigration

> Kristian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org