The Mesilas Yesharim mentions 5 times where Dovid praises himself:
1) Dovid praises his Middas HaZ’rizus:
וְד וִדָָׂׂ ה י הָׂמְ שׁ ב ח ָׂע לָׂח לְ קוָֹׂוְאוֹמ ר:ָָָׂׂׂח שְׁ תִ יָׂוְל ֹאָׂהִ תְ מ הְ מ הְ תִ יָׂ לִ שְׁ מֹרָׂמִ צְ ווֹת יךָָׂתהליםָׂקיטָׂסָׂ(מסילתָׂישריםָׂפרקָׂו).
2) He also praises his great desire for Avodas Hashem:
וְא מְ נ םָׂ כְ ב רָָׂׂ ת ָׂ שׁ ה נִ רְ צ הָׂ יוֹת רָׂ בֲ עֲ בוֹד תָׂ ה בוֹר אָׂ יִתְ ב ר ךְָׂ שְׁ מוָָֹׂׂי ד עְ הוּאָׂ ח פ ץָׂ ה ל בָׂ וּתְ שׁוּק תָׂ ה נְ שׁ מ ה.ָׂ וְהוּאָׂ מ הָׂ ש ד וִדָׂ ה מ ל ךְָׂמִ תְ ה ל לָׂבְ ח לְ קוָֹׂה טּוֹבָׂוְאוֹמ ר:ָָׂׂכְ א י לָׂת עֲ רֹגָׂע לָָׂׂ אֲ פִ יק יָׂמ יִםָׂכ ןָׂנ פְ שִׁ יָׂת עֲ רֹגָׂא ל יךָָָׂׂאֱ לֹהִ ים,ָׂצ מְ א הָׂנ פְ שִׁ יָָׂׂ ל אלָֹׂקִים,ָָׂׂוגו' תהלים מב בָָׂׂנִ כְ סְ פ הָׂ וְג םָׂ כ לְ ת הָׂ נ פְ שִׁ יָׂ לְ ח צְ רוֹתָׂה' תהלים ד גָָׂׂצ מְ א הָׂלְ ךָָׂנ פְ שִׁ יָׂכ מ הָׂלְ ךָָׂבְ שֹ רִ יָׂ תהלים סג בָׂ(מסילתָׂישריםָׂפרקָׂז).
3) And on his Middas HaN’kiyus (being cleansed from all Chet):
וְ הִ נֵּה עַ ל מִ דָּ ה זוֹ הָּ יָּה דָּ וִ ד ש ָּ מֵּ חַ בְ עַ צְ מוֹ וְ אוֹמֵּ ר: אֶ רְ חַ ץ בְ נִ קָּ יוֹן כַפָּ י וַאֲ ס בְ בָּ ה אֶ ת מִ זְ בַ חֲ ךָ ה' תהלים כו ו. And he asked to be rewarded for this: יִ גְ מְ לֵּ נִ י ה' כְ צִ דְ קִ י כְ ב ר יָּדַ י יָּשִ יב ילִ תהלים יח כא (מסילת ישרים פרק י).
4) Also, his goodness to people:
וְ דָּ וִד הָּ יָּה מִ תְ הַ לֵּ ל בְ מִ דָּ תוֹ ז את הַ טּוֹבָּ ה, שֶ אֲ פִ לּוּ לְ ש וֹנְ אָּ יו הָּ יָּה מִ שְ תַ דֵּ ל לְ הֵּ יטִ יב (מסילת ישרים פרק יט).
5) Also, his Yiras Shamayim:
וְ אָּ מְ נָּם דָּ וִ ד הַ מֶ לֶ ךְ ע"ה הָּ יָּה מְ שַ בֵּ חַ וְ אוֹמֵּ ר: אֶ שְ תַ חֲ וֶה אֶ ל הֵּ יכַל קָּ דְ שְ ךָ בְ יִ רְ אָּ תֶ ךָ תהלים ה ח (מסילת ישרים פרק יט).
The Gemara in Brachos brings a Passuk where Dovid says: לְ ד וִדָָׂׂשׁ מְ ר הָׂנ פְ שִׁ יָׂכִ יָׂח סִ ידָׂא נִָׂיָָׂׂ תהליםָׂ פוָׂ ב I’m a big Tzadik, and the Gemara brings two Pshat'im why Dovid called himself a Chasid, and mentioned his superiority over other kings. First, that he woke up at Chatzos (midnight) as it says: חֲ צוֹתָׂ ל יְל הָׂ א קוּםָׂ לְ הוֹדוֹתָׂ ל ךְָָׂׂתהליםָׂ קיטָׂ סב whereas the other kings slept until three hours in the day. And second, how other kings sat around together in all their glory, whereas: ו אֲ נִ יָׂ י ד יָָׂׂ מְ לֻכְ ל כוֹתָׂ בְ ד ם he was busy being פִָׂשְָׁׂמ ָׂיל (lowering) himself and getting his hands dirty: כְ ד יָׂ לְ ט ה רָׂ אִ ש הָׂ לְ ב עְ ל ה and also getting Bizyonos from: מְ פִ יבֹשׁ ת Mefi’boshes, who was superior in learning, and Paskened different than Dovid.
The Mesilas Yesharim also mentions how Dovid praised himself: ו אֲ ד בְ ר הָׂ בְ ע דֹת יךָָׂ נ ג דָָׂׂ מְ ל כִ יםָׂ וְל ֹאָׂ א בוֹשָָׁׂׂתהליםָׂ קיטָׂ מו by speaking in learning with the other kings, instead of boasting of his accomplishments, and he didn’t mind the Bizyonosָָׂׂof the other kings.
The Gemara in Pesachim tells a story that one day in the future, Avrohom, Yitzchok, Yaakov, Moshe, and Yehoshua will be seated at a Seuda, and each one feels unworthy to take the: כוָֹׂסָׂשׁ ָׂלָׂבְָׂהכ ָׂר ָׂ cup of wine for bentching, each one for various reasons. And then Dovid says: אֲ נִּ י אֲ בָ רֵ ךְ וְ לִּ י נָאֶ ה לְ בָ רֵ ךְ I will bentch, and it is appropriate that I should be the one to bentch.
This is the same Dovid who said: וְא נֹכִ יָׂתוֹל ע תָָׂׂ וְל ֹאָׂ אִ ישָָׁׂׂתהליםָׂ כבָׂ ז I am like a worm and not a human. Dovid was a special Anav, and yet he acted with such Romemus! The Rambam says that the Melech has to have: ע ָׂנ ָׂו ָׂהָׂיְָׂת ָׂיר ָׂ הָׂ extreme Anava. The Chovos Halvavos says that before a person has Anava, he has to know his value; the more you realize your greatness, the more you owe Hashem, and you are Mach'nia more.
So all those who work on: ו יִ גְ ב הָׂ לִ בוָֹׂ בְ ד רְ כ יָׂ ה'ָׂ (lifting your heart in order to serve Hashem) with all kinds of acts of Ga'ava, are actually working on Anava, since the more they realize and appreciate the Maalos that Hashem gave them, the more they are humbled with loads of gratitude. The so- called Anav who keeps putting himself down, is actually ungrateful to Hashem for all those Maalos that he denies he has.
