Friday, May 17, 2013

CQ5/AEM GOTCHYA - Why you should set all @Reference variables to null

What you should do

When writing sling servelets, all @Reference variables should be set to null


We experienced an issue where when changing pom, reference was still being kept between updates. It seems that if your running servelets have injected an @Reference variable, if a change causes the @Reference variable to not successfully be able to be injected, it will only happen when the instance has been destroyed.

This is confusing as it makes it hard to narrow down which change has caused an @Reference variable to no longer be injected.

No comments:

Post a Comment