Hab 3:17-19 Though the fig tree should not blossom, nor fruit be on the vines, the produce of the olive fail and the fields yield no food, the flock be cut off from the fold and there be no herd in the stalls, yet I will rejoice in the Lord; I will take joy in the God of my salvation. God, the Lord, is my strength; he makes my feet like the deer's; he makes me tread on my high places. ESV
Here is a very well-known passage where Habakkuk declares that despite the failure of the harvests of grapes and olives and death of the flocks, he will nevertheless rejoice in the Lord. Some may say that it's unrealistic to expect anyone to rejoice in the adversity. But Habakkuk is not saying we rejoice in the adversity but in the Lord: "I will take joy in the God of my salvation." In other words, he is calling us to rejoice in what we have (the Lord), not what we don't have (crops and flocks). Instead of focusing on our loss, we focus on our gain.
The Apostle Paul considers everything as worthless compared to gaining Christ: "But whatever was to my profit I now consider loss for the sake of Christ. What is more, I consider everything a loss compared to the surpassing greatness of knowing Christ Jesus my Lord, for whose sake I have lost all things. I consider them rubbish, that I may gain Christ." (Phil 3:7-8). So, the key to keeping our joy is to focus on the Lord who is our strength and our salvation. If we have the Lord, we have everything. If we have the Lord, He can restore to us the crops and flocks we have lost. And so we can rejoice in the Lord because He is always there--whether in prosperity or in adversity. He is our greatest gain and nothing else can change the supreme worth of knowing Christ.
So, whatever may be our circumstances (good or bad), we can always rejoice in the Lord, for He is always with us and His supreme worth never changes. To possess Christ makes all other possessions seem like loss anyway. So Paul also says, "Rejoice in the Lord always. I will say it again: Rejoice!" (Phil 4:4-5).
Father, thank You that we can rejoice in You despite adversity because You are our most precious possession, surpassing everything else on earth. Amen.