コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

Doubt w.r.t @Reference Annotation usage

Avatar

Level 9

Hi All,

Doubt as below :

I have an interface where couple of methods are defined. In my component Java class[which is not a service class], if I have to refer any of the method present in the interface, it is not possible.

- Is my Understanding correct?

- Any way we can access methods declared in the interface, via my Component java class?

Any thoughts/pointers on this will be helpful.

1 受け入れられたソリューション

Avatar

正解者
Level 9

Yes. Your understanding is correct. 

POJO class can't refer to methods which are in service. There are multiple ways to pass service to your component class. Sling models do provide a way to inject services directly to the component class. You can try that.

https://helpx.adobe.com/experience-manager/using/sling_models.html

Let me know if you are not willing to use SlingModesl. There are other ways as well.

--

Jitendra

元の投稿で解決策を見る

2 返信

Avatar

正解者
Level 9

Yes. Your understanding is correct. 

POJO class can't refer to methods which are in service. There are multiple ways to pass service to your component class. Sling models do provide a way to inject services directly to the component class. You can try that.

https://helpx.adobe.com/experience-manager/using/sling_models.html

Let me know if you are not willing to use SlingModesl. There are other ways as well.

--

Jitendra

Avatar

Level 9

Hi Jitendra,

Thank you for your reply. Used getSlingscriptheler.getservice() and it worked.