David told Solomon to be strong, keep the charge of the LORD, and walk in his ways as written in the law of Moses (1 Kings 2:2-3). He linked obedience to prospering and to the promise of an enduring royal line if David’s sons walked faithfully (1 Kings 2:4).
As David nears death, he gives Solomon a final charge about leadership and loyalty. David tells Solomon to be strong and to act with mature courage, then centers the task on keeping Yahweh’s requirements as written in Moses’ law. David links this careful obedience with wise success in Solomon’s actions and direction. These verses open the transition from David’s reign to Solomon’s reign, setting a program for what “good kingship” should look like in the story. The scene is a deathbed speech: David’s approaching death provides urgency, while the charge supplies a measuring-stick for Solomon’s future choices.
David’s final words to Solomon frame kingship as a moral and covenant task, not only a political one. The text explicitly ties Solomon’s “strength” to guarding Yahweh’s requirements and living by a written standard (“the law of Moses”), not to personal charisma or military force.
A careful answer keeps the immediate passage, the book's argument, and the whole-Bible storyline together, so the question is answered in context instead of as a detached idea.
Start with 1 Kings 2:2-3, then read the surrounding section so the answer stays connected to the passage's flow.
2I am going the way of all the earth: be you strong therefore, and show yourself a man;
3and keep the charge of Yahweh your God, to walk in his ways, to keep his statutes, [and] his commandments, and his ordinances, and his testimonies, according to that which is written in the law of Moses, that you may prosper in all that you do, and wherever you turn yourself.