The Psalms are attributed to David because David himself did write Psalms (hymns to God), and the many subsequent contributors wrote in the Davidic style and tradition. We cannot now tell exactly which verses were written by David, which written by him but edited substantially, and which added later.
The same is true of the Book of Wisdom. Solomon wrote his wisdom down, and this was the basis for the later wisdom books, including the Song of Solomon and the Book of Wisdom. The Book of Wisdom is based on Solomon's words and writings, and most likely includes the work of many contributors, writing in the style and tradition of Solomon.