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

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

Mark Solution

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

解決済み

Alternative of deprecated SlingSettingsService

Avatar

Level 6

Hi,

 

Does anyone know/has implemented something that helps you to fetch the runmode in backend code. SlingSettingsService has been deprecated

WCMMode doesn't work in this case as we need to check it on a editable template(structure), where wcmmode is disabled.

 

Thanks!

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

Avatar

正解者
Community Advisor

Hi

Till the time we have alternative of SlingSettingService you can set run mode config value with OSGI configuration and read this in you backend code.

 

Thanks

Dipti

元の投稿で解決策を見る

7 返信

Avatar

Community Advisor and Adobe Champion

@ibishika,
it looks like the solution is still in the planning phase: https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/2476

Avatar

正解者
Community Advisor

Hi

Till the time we have alternative of SlingSettingService you can set run mode config value with OSGI configuration and read this in you backend code.

 

Thanks

Dipti

Avatar

Community Advisor

Hi @Dipti_Chauhan ,

 

Do you have any examples, which we can refer as I have also same requirement and we need to use an alternative?
Thanks!

Avatar

Employee Advisor

 

Your code should not reference any runmode (either directly or indirectly), instead it should get expressed via OSGI configuration. I wrote an article for it some time ago, which explains how you can/should do that: https://cqdump.joerghoh.de/2018/09/12/referencing-runmodes-in-java/

 

cheers,

Jörg

Avatar

Level 6
@Jörg_Hoh, I did use OSGi configuration to implement the same and that worked as expected. My actual requirement was simple enough. I wanted to display some message on the component in edit mode. But edit mode is disabled in template structure. I never noticed something like this before and had an impression that any page having "editor.html" in URL is in edit mode. I would love to understand the reason behind why wcmmode is in disabled state in template structure. Do let me know if you know why is that so.

Avatar

Employee Advisor
so you mean that when you create/modify an editable template, the wcmmode is not set properly?

Avatar

Level 6
@Jörg_Hoh Yes that's right. When I fetch the wcmmodes on editable template the only mode that returns true is ${wcmmode.disabled}. ${wcmmode.edit} returns false.