expression

Adversity is a great schoolmaster.

Theme: experience Keyword: school

suggests that

hardship can teach valuable lessons and help people develop wisdom, resilience and practical judgment.

also

Adversity and loss make a man wise. Adversity is a good discipline.

Example

When her first business failed, she learned to manage money and assess risks much more carefully — adversity is a great schoolmaster.