On Mar 26, 2009, at 10:32 AM, Jerome Velociter wrote:
Vincent Massol wrote:
Hi devs,
I'm continuing on this topic since I really believe we need
annotations now. However I think it's best to have our own
annotations
for injection.
One reason we need annotation (amongst other needs) is in order to be
able to create a xwiki uberjar for rendering modules for example.
With
components.xml you cannot easily merge jars since you'd need to merge
components.xml so you'd need to write some xslt code for that.
Another reason is that we have to comment in the code things such as
"this field is injected automatically by the component manager". Of
course this comment is forgotten most of the time. It's much nicer to
have a @Inject annotation.
Last we need annotations if we want to be able to more easily support
different IOC frameworks since otherwise it means that for each fwk
we
need to do again all components mappings in a static way.
If we have our own annotations, doesn't that require each IOC/DI
framework support them ?
We need to write an adapter to them yes.
+1 to switch to annotations, be they our owns or from
another
framework.
We could use their but:
1) it requires adding not required dependencies (like having the guice
jar even if we use plexus for ex)
2) it means we'd have cluttered and duplicated code like:
@Component
@Inject
@Whatever
public class MyCode...
3) If 2 fwk use the same annotation we're stuck.
Thanks
-Vincent
Jerome.
>
> Of course one basic need is evidently to reduce the number of config
> lines we have to write and the errors associated with them.
>
> I'm going to look into plexus annotations for a starter (+ guice) to
> see how they do it and then I'll make a proposal for annotations.
>
> Let me know what you think.
>
> Thanks
> -Vincent