If one party wishes to apply to the court, and they meet the legal requirements for spousal maintenance, it will be payable. There is no ‘getting out of it’.
However, if you can come to an agreement with your former spouse or de facto partner on maintenance payments, ideally at the time of property separation, this is preferable.