ISPN-2699 Fix compilation error in the Spring module

Please cherry-pick to the `5.2.x` branch as well.