I just pushed a first draft into
https://raw.githubusercontent.com/apache/sling-site/SLING-11711-update-slingmodels-doc/src/main/jbake/content/documentation/bundles/models.md

I moved over to the injector-specific annotations and moved the discouraged
one to the bottom. On top I restructured the documentation in a way to have
the most relevant informations on the top, moving specialized topics to the
bottom.

I struggle a bit with the documentation of the replacements of the @Via
annotation. Can you someone point me to me some example code showing how it
can be done with the injector-specific annotations?

(Unfortunately the test code in the sling-models bundle is still using
@Inject and friends, and we should eventually port them over to use the
injector-specific annotations as well.)

Jörg



Am Do., 8. Dez. 2022 um 10:45 Uhr schrieb Stefan Seifert
<stefan.seif...@diva-e.com.invalid>:

> +1
>
> using @Inject is not only a performance problem, it also may lead to
> unexpected results if an injector steps in you are not aware of.
>
> stefan
>
> > -----Original Message-----
> > From: Jörg Hoh <jhoh...@googlemail.com.INVALID>
> > Sent: Thursday, December 8, 2022 10:25 AM
> > To: Sling Developers List <dev@sling.apache.org>
> > Subject: [Sling Models documentation] discourage the use of @Inject
> >
> > Hi,
> >
> > currently the the Sling Models documentation is a bit confusing; the
> > examples show only the use of the "@Inject" annotation, while more down
> > (at
> > [1]) in an not obvious location the use of @Inject is discouraged.
> > Also, when I benchmarked the use of Sling Models with different
> > annotations [2] I found that in some situations @Inject can have a huge
> > performance penalty compared to the injector-specfic annotations, so I
> > would also argue from this perspective, that we should heavily discourage
> > the use of @Inject.
> >
> > But at the top we state as one of the design goals of Sling Models to use
> > standard annotations (which are mostly discouraged at [1] in favor of
> > custom annotations).
> >
> > In the context of SLING-11711 I plan to  rework the documentaiton and
> all
> > examples to use injector-specific annotations, remove the design goal of
> > standard annotations, and mention the discouraged annotations only in a
> > separate section as discouraged (not deprecated!).
> >
> > WDYT?
> >
> > Jörg
> >
> >
> > [0] https://sling.apache.org/documentation/bundles/models.html
> > [1] https://sling.apache.org/documentation/bundles/models.html#hints-1
> > [2] https://cqdump.joerghoh.de/2022/11/28/sling-model-performance/
> > [3] https://issues.apache.org/jira/browse/SLING-11711
> > --
> > Cheers,
> > Jörg Hoh,
> >
> > https://cqdump.joerghoh.de
> > Twitter: @joerghoh
>


-- 
Cheers,
Jörg Hoh,

https://cqdump.joerghoh.de
Twitter: @joerghoh

Reply via email to