See Rashi on Megillah 14a, who cites Sefer Halachos Gedolos in the name of Seder Olam, who count Davidcounts David and Shlomo in the list of the 48 Neviim.
However the Gra in his emendations (ad loc.) takes DavidDavid and Shlomo out of the count.
See also Zohar (II, 154a) that states that Moshe Rabbeinu was the only person in history to merit both prophecy and monarchy. This would theoretically exclude David and Shlomo.