Ibn Qayyim al Jawziyyah
"So also if the father, who is compassionate towards his son, knowing what is good for him, sees that some bad blood has to be removed from his son for his own good, by incurring severe pain by cutting his skin and cutting his veins. If he knows that his cure lies in cutting off one of his limbs, he does so and does all of this out of compassion and mercy to his son. If he sees that the betterment of his son lies in him withholding something from him, he withholds it from him, and is not lavish towards him because he knows that this causes his corruption and destruction and he often withholds from his son what he desires for his own good and to protect him, not out of miserliness towards him.
So, if the wisest of all judges, the Most Merciful, the Most Knowledgeable, who is more merciful towards His servants than they are to themselves or their parents are to them, sends down upon them that which they dislike, then it is better for them than Him not sending it upon them, rather it is a benevolence and kindness to them. For if they were left to choose for themselves they would be incapable of knowing, intending or doing that which benefits them, but He - how perfect He is - has taken charge of managing their affairs according to His knowledge, wisdom and mercy, whether they like or dislike it. This being known to those who believe with certainty in Allah's Names and Attributes (1), so they do not find fault in any of His laws. This is hidden to those ignorant of Allah, His Names and Attributes, so they disputed with Him in His regulations and found reproach in His wisdom and did not submit to His decisions, but rather opposed them with their corrupt intelligence, false opinions and unjust behaviour. So they did not know their Lord nor did they achieve that which benefits them. And Allah is the One who bestows.
Hence when the servant succeeds, by way of this knowledge, he lives in a Paradise in this world before the Hereafter, whose comforts can only be compared to the comforts of Paradise in the Hereafter. Verily he does not cease to remain pleased with his Lord and this pleasure is the Paradise of this world and a comfort to those who have knowledge. Indeed his soul is content with all that it encounters from the decree which Allah has chosen for him, and his soul is at peace with His religious laws and this is pleasure with Allah being the Lord, with Islaam as the way of life , and Muhammad (saw) as being the Messenger, and whoever has not achieved this has not tasted iman."
"And it may be that you dislike a thing which is good for you and it may be that you like a thing which is bad for you. Allah knows but you do not know" (2:216)
(1) By this, it means that if one truly believes and recognises the Attributes of Allah swt then the individual trusts in His decree.. for example we know that He is the Just then we have confidence in His justice, that He would not decree it if it were not the best for us.