I think it largely depends on if you want service injection or not. If
your "component" requires other services it might make sense to make
it plexus-managed.

As an example, I have been irritated the the plexus-io collections are
themselves plexus-components. This is because they get the plexus
logger injected by the container. The alternative to container
injection is to move the required service to the interface that the
client code is exposed to. In some cases this means the client needs
to "know" things it shouldn't; by moving the dependency to the
"business-level" interface of your component you require your user to
have a relationship to that component as well. (When it comes to
logging, most log frameworks use static-method based injection - which
probably might have been a better choice for plexus logging too, which
makes it even more irritating that this was the sole reason they were
made components in the first place).

So using injection can make the client "see" less of your component,
which may be a good thing.

Kristian


2014-12-02 18:30 GMT+01:00 Benson Margulies <bimargul...@gmail.com>:
> I'm working on a plugin where there's a use-case in which the user
> will want to add something to the plugin's classpath and then
> configure a class.
>
> Is there any advantage to using plexus injection for this as opposed
> to just ordinary classpath fishing for a named class?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>

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

Reply via email to