Into Your hand I commit my spirit; You have redeemed me, O LORD God of truth.
Godly men through the ages have totally committed themselves to God, in the good times and in the bad times. David here was in distress, as if caught in a trap secretly laid for him by his enemies (Psalm 31:4).
Jesus Christ quoted the first part of this verse shortly before He gave His life (Luke 23:46), and Stephen also committed his spirit to Jesus when he was being martyred for preaching the gospel (Acts 7:59). They both knew that God would bring them back to life through a resurrection.