Yes, Lord Jesus was teaching even while upon His cross, when He quoted that from Psalms 22. God had given David to prophesy of that in Psalms 22, "Eli, Eli, lama sabachthani?" (Matt.27:46)
Ps 22:1
22 My God, my God, why hast Thou forsaken Me? why art Thou so far from helping me, and from the...