When Goethe says that in every human condition foes lie in wait for us, "invincible only by cheerfulness and equanimity," he does not mean that we can at all times be really cheerful, or at a moment's notice; but that the endeavor to look at the better side of things will produce the habit, and that this habit is the surest safeguard against the danger of sudden is evils.
Table-talk: To which are Added Imaginary Conversations of Pope and Swift (ed. 1870)