Some thoughts on the character of David:
From New Advent:
David was not merely king and ruler, he was also a prophet. "The spirit of the Lord hath spoken by me and his word by my tongue" (2 Samuel 23:2) is a direct statement of prophetic inspiration in the poem there recorded. St. Peter tells us that he was a prophet (Acts 2:30). His prophecies are embodied in the Psalms he composed that are literally Messianic and in "David's last words" (2 Samuel 23). The literal character of these Messianic Psalms is indicated in the New Testament. They refer to the suffering, the persecution, and the triumphant deliverance of Christ, or to the prerogatives conferred on Him by the Father. In addition to these his direct prophecies, David himself has always been regarded as a type of the Messias. In this the Church has but followed the teaching of the Old Testament Prophets. The Messias was to be the great theocratic king; David, the ancestor of the Messias, was a king according to God's own heart. His qualities and his very name are attributed to the Messias. Incidents in the life of David are regarded by the Fathers as foreshadowing the life of Christ; Bethlehem is the birthplace of both; the shepherd life of David points out Christ, the Good Shepherd; the five stones chosen to slay Goliath are typical of the five wounds. the betrayal by his trusted counsellor, Achitophel, and the passage over the Cedron remind us of Christ's Sacred Passion. Many of the Davidic Psalms, as we learn from the New Testament, are clearly typical of the future Messias. (more)
From Christian Answers:
...Both in his prophetical and in his regal character David was a type of the Messiah (1 Sam. 16:13). The book of Psalms commonly bears the title of the “Psalms of David,” from the circumstance that he was the largest contributor (about eighty psalms) to the collection. (See PSALMS.)
“The greatness of David was felt when he was gone. He had lived in harmony with both the priesthood and the prophets; a sure sign that the spirit of his government had been throughly loyal to the higher aims of the theocracy. The nation had not been oppressed by him, but had been left in the free enjoyment of its ancient liberties. As far as his power went, he had striven to act justly to all (2 Sam. 8:15). His weak indulgence to his sons, and his own great sin besides, had been bitterly atoned, and were forgotten at his death in the remembrance of his long-tried worth. He had reigned thirty-three years in Jerusalem and seven and a half at Hebron (2 Sam. 5:5). Israel at his accession had reached the lowest point of national depression; its new-born unity rudely dissolved; its territory assailed by the Philistines. But he had left it an imperial power, with dominions like those of Egypt or Assyria. The sceptre of Solomon was already, before his father's death, owned from the Mediterranean to the Euphrates, and from the Orontes to the Red Sea” Geikie's Hours etc., iii.