The Gemara discusses David's wars and the requirement of a Sanhedrin to authorize them, providing halakhic context for understanding David as a man of war and what that designation means.
אֶלָּא, כִּי הָא דְּאָמַר רַב אַחָא בַּר בִּיזְנָא אָמַר רַבִּי שִׁמְעוֹן חֲסִידָא: כִּנּוֹר הָיָה תָּלוּי לְמַעְלָה מִמִּטָּתוֹ שֶׁל דָּוִד. כֵּיוָן שֶׁהִגִּיעַ חֲצוֹת לַיְלָה, רוּחַ צְפוֹנִית מְנַשֶּׁבֶת בּוֹ וְהָיָה מְנַגֵּן מֵאֵלָיו. מִיָּד הָיָה דָּוִד עוֹמֵד וְעוֹסֵק בְּתוֹרָה עַד שֶׁעָלָה עַמּוּד הַשַּׁחַר. כֵּיוָן שֶׁעָלָה עַמּוּד הַשַּׁחַר, נִכְנְסוּ חַכְמֵי יִשְׂרָאֵל אֶצְלוֹ. אָמְרוּ לוֹ: אֲדוֹנֵינוּ הַמֶּלֶךְ, עַמְּךָ יִשְׂרָאֵל צְרִיכִין לְפַרְנָסָה. אָמַר לָהֶן: לְכוּ וְהִתְפַּרְנְסוּ זֶה מִזֶּה. אָמְרוּ לוֹ: אֵין הַקּוֹמֶץ מַשְׂבִּיעַ אֶת הָאֲרִי, וְאֵין הַבּוֹר מִתְמַלֵּא מֵחוּלְיָיתוֹ. אָמַר לָהֶם: לְכוּ פִּשְׁטוּ יְדֵיכֶם בִּגְדוּד. מִיָּד יוֹעֲצִין בַּאֲחִיתוֹפֶל, וְנִמְלָכִין בְּסַנְהֶדְרִין, וְשׁוֹאֲלִין בְּאוּרִים וְתוּמִּים. אָמַר רַב יוֹסֵף: מַאי קְרָא?
Rather, the proof is like that which Rav Aḥa bar Bizna says that Rabbi Shimon Ḥasida says: A lyre hung above David’s bed, and once midnight arrived, the northern midnight wind would blow on it and cause the lyre to play on its own. David would immediately rise from his bed and study Torah until the dawn arrived. Once dawn arrived, the Sages of Israel would enter to advise him with regard to the various concerns of the nation and the economy. One time they said to him: Our master the king, your nation, Israel, requires sustenance. King David said to them: Go and sustain one another, i.e., provide each other with whatever is lacking. The Sages said to him in response, citing a parable: A single handful [hakometz] of food does not satisfy a lion, and a cistern will not be filled merely from the rain that falls directly into its mouth, but other water must be channeled in. So too, the nation cannot sustain itself using its own resources. King David then told them: Go and take up arms with the troops in battle in order to expand our borders and provide our people with the opportunity to earn a livelihood. The Sages immediately sought advice from Ahithophel to determine whether or not it was appropriate to go to war at that time and how they should conduct themselves; and they consulted the Sanhedrin in order to receive the requisite permission to wage a war under those circumstances; and they asked the Urim VeTummim whether or not they should go to war, and whether or not they would be successful. Rav Yosef says: What is the verse from which this aggada is derived?