Justin Edelson created SLING-3876:
-------------------------------------

             Summary: SelfInjector is too aggressive
                 Key: SLING-3876
                 URL: https://issues.apache.org/jira/browse/SLING-3876
             Project: Sling
          Issue Type: Bug
          Components: Extensions
            Reporter: Justin Edelson
             Fix For: Sling Models Implementation 1.0.8


The service ranking of the self injector is currently 100. Since the only 
restriction it has is based on class, this blocks any of the other standard 
injectors from providing an object which has the same supertype as the 
adaptable. For example, if you did:

Resource someOtherResource = resourceResolver.getResource("/something");
request.setAttribute("foo", someOtherResource);

@Model(adaptable=Resource.class)
public interface GettingFoo {

@Inject @Named("foo")
Resource getFooResource();
}

getFooResource() would return the adaptable, not the resource.

I'll increase the service ranking to MAX_INTEGER as a first step, but this 
might require something additional.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to