It is narrated from Sayyiduna Anas (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) smiled, then said: "I marvel at the believer: indeed, whatever Allah decrees for him is only good for him."
Imam Abu Ya'la al-Mawsili (may Allah have mercy on him) narrated it from Muhammad bin Abdullah bin Numayr (may Allah have mercy on him), from Abu Khalid al-Ahmar (may Allah have mercy on him), from al-Hasan bin Ubaydullah (may Allah have mercy on him).
And (Imam Abu Ya'la (may Allah have mercy on him)) also narrated it from Abu Bakr bin Abi Shaybah (may Allah have mercy on him), from Waki' (may Allah have mercy on him), from Sufyan (may Allah have mercy on him), from al-Qasim bin Shurayh (may Allah have mercy on him).
And Asim al-Ahwal (may Allah have mercy on him) narrated something similar through Tha'labah bin Asim (may Allah have mercy on him) from Sayyiduna Anas (may Allah be pleased with him).
Related hadith on this topic