The combination of David"s final song (in the text, ch22) followed by his last testament ( 2 Samuel 23:1-7) recalls the similar combination of Moses" final song and his last testament ( Deuteronomy 32 , 33). This was David"s final literary legacy to Israel. [source][source][source]
"Whereas the psalm in the previous chapter celebrates the delivering acts of Yahweh by which the Davidic supremacy was established, this little poem is composed around the theme of the dynastic covenant through which the continued prosperity of the Davidic house was vouchsafed." [1][source]
This poem also has a chiastic structure focusing on the Lord speaking ( 2 Samuel 23:3-4). His words describe the ideal king. They are messianic. However the passage also anticipates all of David"s successors. [source][source][source]
The same great spiritual themes come through here as in the previous chapter and in the whole historical account recorded in1,2Samuel. The ancients regarded the last words of any person as especially significant. The last words of Israel"s great leaders were even more important. The last words of prophets were extremely important (cf. Genesis 49; Deuteronomy 33; Acts 20:17-38; et al.). They often expressed lessons those who had walked with God for many years had learned. [source][source][source]
The writer described David as simply the son of Jesse, a common Israelite, and as someone whom God had raised up, in contrast to a self-made man ( 2 Samuel 23:1; cf. Daniel 4:29-33). David always viewed himself as one whom God had chosen and anointed for his role in life ( 2 Samuel 23:1). He was the Lord"s anointed and the sweet psalmist. These four descriptions of David picture his leadership in relation to his family, his political administration, his military forces, and his spiritual influence. [source][source][source]
David claimed that the words that he had spoken had been received from God ( 2 Samuel 23:2). He thus gave God the credit for his inspiration. He also recognized God as the real ruler of Israel ( 2 Samuel 23:3). Many ancient as well as modern interpreters of this book have understood David"s description of Israel"s ruler in 2 Samuel 23:3-4 as a reference to Messiah. It probably also describes David and his royal descendants. The figure of the dawning sun pictures the righteous ruler as a source of promise, joy, and blessing to his people ( 2 Samuel 23:4). The figure of the sprouting grass describes him as a source of prosperity, new life, and fertility ( 2 Samuel 23:4). David viewed his dynasty this way because God had made an everlasting covenant (the Davidic Covenant) with him ( 2 Samuel 23:5). This resulted in order, security, deliverance, and fulfillment of desire ( 2 Samuel 23:5). David believed that the covenant would result in increased blessing for his house ( 2 Samuel 23:5). The worthless would suffer the reverse fate, however, and even be burned up as useless (cf. Matthew 13:30). [2][source]
To summarize, David believed that the Lord sovereignly initiates blessing, and those who value it cause His blessings to increase on themselves and others. [source][source][source]