I like the idea.
I just wonder if it might be a bit inconsistent to use @Inject when
most of the other code in a sling project (OSGI components) uses
@Reference.
As a developer I would appreciate consistency in how dependency
injection is done.

Regards,
 Markus

On Tue, Mar 15, 2011 at 2:51 AM, Justin Edelson
<[email protected]> wrote:
> I was looking at how much code is involved in referencing an OSGi
> service from a script built using the scripting.java bundle and think
> it's a bit verbose:
>
> SlingBindings bindings = (SlingBindings)
> request.getAttribute(SlingBindings.class.getName());
> SlingScriptHelper sling = bindings.getSling();
> Interface service = sling.getService(Interface.class);
>
> I was thinking about adding some kind of annotation-based injection
> support so that you could replace these lines with just:
>
>
> @Inject
> private Interface service;
>
> public void service(request, response) {
>  // some code using service
>
> }
>
> @Inject seems like the obvious candidate to support for this. WDYT?
>
> Justin
>

Reply via email to