내 커뮤니티 업적 표시줄을 확대합니다.

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

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

Non-serializable service references

Avatar

Level 1

Re-posting this question in the Adobe Experience Manager section

Hi, we recently started using the Cloud Manager pipelines to run analysis on our code and one of the critical code smells that keep popping up is the following:

 

IssueTypeSeverityEffortRuleTagsDocumentation
Make "cryptoSupport" transient or serializable.Code SmellCritical30minsquid:S1948cwe,serializationhttps://www.adobe.com/go/aem_cmcq_s1948_en

 

In this case "cryptoSupport" refers to an injected service that implements the com.adobe.granite.crypto.CryptoSupport interface.

 

@reference
private CryptoSupport cryptoSupport;

 

My question is: Since we can't make CryptoSupport serializable, is it safe to declare the field as transient? Is there any danger of our servlet (that contains the above service reference) being flushed to disk at some point and failing to restore the service reference later?

 

Thank you,

William.

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Community Advisor

Hi @Williamvdev 

You should be able to make it as transient and it should not have any issue as they will not be part of persistent state.

@Reference
private transient CryptoSupport cryptoSupport;

Thanks! 

원본 게시물의 솔루션 보기

1 답변 개

Avatar

정확한 답변 작성자:
Community Advisor

Hi @Williamvdev 

You should be able to make it as transient and it should not have any issue as they will not be part of persistent state.

@Reference
private transient CryptoSupport cryptoSupport;

Thanks!