Alternative of deprecated SlingSettingsService | Community
Skip to main content
ibishika
New Participant
June 15, 2021
Solved

Alternative of deprecated SlingSettingsService

  • June 15, 2021
  • 3 replies
  • 8688 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Dipti_Chauhan

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

3 replies

joerghoh
Employee
June 18, 2021

 

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

ibishika
ibishikaAuthor
New Participant
June 18, 2021
@joerghoh, 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.
Dipti_Chauhan
Dipti_ChauhanAccepted solution
New Participant
June 16, 2021

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

iamnjain
New Participant
February 28, 2023

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!

BrianKasingli
New Participant
June 15, 2021

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