[ 
https://issues.apache.org/jira/browse/SLING-11507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17597070#comment-17597070
 ] 

Joerg Hoh edited comment on SLING-11507 at 8/29/22 9:17 AM:
------------------------------------------------------------

[~cziegeler] Valid point. We should always print a warning and just optionally 
refuse the injection on runtime. A build-time check should always fail with a 
proper recommendation how to fix the problem.


was (Author: joerghoh):
[~cziegeler] Valid point. We should always print a warning and just optionally 
refuse the injection.

> Field injection should not inject static fields
> -----------------------------------------------
>
>                 Key: SLING-11507
>                 URL: https://issues.apache.org/jira/browse/SLING-11507
>             Project: Sling
>          Issue Type: Task
>          Components: Sling Models
>    Affects Versions: Models Impl 1.4.14
>            Reporter: Joerg Hoh
>            Priority: Major
>
> Currently this injection works:
> {noformat}
>         @SlingObject
>         private static ResourceResolver resourceResolver;
> {noformat}
> but it should not. Sling Models are Pojos and injection must never inject 
> into static fields. Instead it should throw an exception and an error message 
> indicating the problem.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to