While David gives Solomon advice for his life after David is gone, we should note the specific order he gives it. David gives the Spiritual then the Political. It is evident in David’s life and in his talk here that David felt that no matter how well/bad you do in other things, if you put God first the rest will fall into place. David begins by telling Solomon that if he would stick with God, his Kingdom would not fail.
This is true for us today as well. Sure, some prosper in this world who never consider God. But, those who put Him first in their lives seem to not only prosper in worldly terms, but also heavenly. Following God is the only way to be truly successful.