David's time was coming to an end. So he commanded Solomon his son,
References for 1 Kings 2:1
"I'm following the path that the whole earth takes. Be strong and be a man.
Guard what is owed to the LORD your God, walking in his ways and observing his laws, his commands, his judgments, and his testimonies, just as it is written in the Instruction from Moses. In this way you will succeed in whatever you do and wherever you go.
So also the LORD will confirm the word he spoke to me: ‘If your children will take care to walk before me faithfully, with all their heart and all their being, then one of your own children will never fail to be on the throne of Israel.'
You should know what Joab, Zeruiah's son, has done to me and what he did to the two generals of Israel, Abner, Ner's son, and Amasa, Jether's son. He murdered them, spilling blood at peacetime and putting the blood of war on the belt around his waist and on the sandals on his feet.
So act wisely: Don't allow him to die a peaceful death.
As for Barzillai's sons from Gilead, show them kindness. Let them eat with you. When I was running away from your brother Absalom, they came to me.
Now as for this Shimei, Gera's son—a Benjaminite from Bahurim—who is with you, he cursed me viciously when I went to Mahanaim. When he came down to meet me at the Jordan, I swore to him by the LORD, ‘Surely I won't execute you with the sword.'
But you don't need to excuse him. You are wise and know what to do to him. Give him a violent death."
Then David lay down with his ancestors and was buried in David's City.
He ruled over Israel forty years—seven years in Hebron and thirty-three years in Jerusalem.
Solomon sat on the throne of his father David, and his royal power was well established.
References for 1 Kings 2:12
Adonijah, Haggith's son, went to Bathsheba, Solomon's mother. She said, "Are you coming in peace?" He said, "Yes.
I have something to say to you." She said, "Say it."
He said, "You know how the kingdom was mine. All Israel had appointed me as their king. Then suddenly the kingdom went to my brother as the LORD willed.
Now I have just one request of you. Don't refuse me!" She said to him, "Go on."
Adonijah continued, "Ask King Solomon to let me marry Abishag from Shunem—he won't refuse you."
Bathsheba said, "Okay; I'll speak to the king for you."