I Kings 2:1-11 NKJV
Now the days of David drew near that he should die, and he charged Solomon his son, saying: “I go the way of all the earth; be strong, therefore, and prove yourself a man. And keep the charge of the LORD your God: to walk in His ways, to keep His statutes, His commandments, His judgments, and His testimonies, as it is written in the Law of Moses, that you may prosper in all that you do and wherever you turn; that the LORD may fulfill His word which He spoke concerning me, saying, ‘If your sons take heed to their way, to walk before Me in truth with all their heart and with all their soul,’ He said, ‘you shall not lack a man on the throne of Israel.’
“Moreover you know also what Joab the son of Zeruiah did to me, and what he did to the two commanders of the armies of Israel, to Abner the son of Ner and Amasa the son of Jether, whom he killed. And he shed the blood of war in peacetime, and put the blood of war on his belt that was around his waist, and on his sandals that were on his feet. Therefore do according to your wisdom, and do not let his gray hair go down to the grave in peace.
“But show kindness to the sons of Barzillai the Gileadite, and let them be among those who eat at your table, for so they came to me when I fled from Absalom your brother.
“And see, you have with you Shimei the son of Gera, a Benjamite from Bahurim, who cursed me with a malicious curse in the day when I went to Mahanaim. But he came down to meet me at the Jordan, and I swore to him by the LORD, saying, ‘I will not put you to death with the sword.’ Now therefore, do not hold him guiltless, for you are a wise man and know what you ought to do to him; but bring his gray hair down to the grave with blood.”
So David rested with his fathers, and was buried in the City of David. The period that David reigned over Israel was forty years; seven years he reigned in Hebron, and in Jerusalem he reigned thirty-three years.
NKJV: New King James Version