John Gills Exposition of the Bible Commentary - 2 Samuel 23:1
Now these be the last words of David ,.... Which refer not to the psalm in the preceding chapter, but to what follows; not the last words he spoke, for he said many things afterwards; for the advice he gave to Solomon, and the instructions to him about building the temple, were delivered after this time; but these were the last after he had finished the book of Psalms; or the last that he spoke under the inspiration of the Holy Spirit, or that he delivered out by way of prophecy; though... read more
Matthew Henry's Complete Commentary - 2 Samuel 23:1-7
We have here the last will and testament of king David, or a codicil annexed to it, after he had settled the crown upon Solomon and his treasures upon the temple which was to be built. The last words of great and good men are thought worthy to be in a special manner remarked and remembered. David would have those taken notice of, and added either to his Psalms (as they are here to that in the foregoing chapter) or to the chronicles of his reign. Those words especially in 2 Sam. 23:5; though... read more