In the framework of relativistic quantum mechanics (not QFT) the Dirac equation in presence of external electromagnetic field is obtained by means of the minimal coupling, i.e. the substitution:
$$p_{\mu} \rightarrow p_{\mu}-eA_{\mu}$$
This substitution is often motivated by saying that it "ensures gauge invariance of the theory" (Greiner "Relativistic quantum mechanics", page 121). The resuting "modified" Dirac equation is:
$$i\frac{\partial\psi}{\partial t}=\left( \vec{\alpha} \left( \vec{p}-e\vec{A} \right)+\beta m + e \phi\right)\psi$$ This equation seems to change if one changes the 4-potential by a gauge transformation $A_{\mu}\rightarrow A_{\mu}+\partial_{\mu}\Lambda$. So what does it mean that the minimal coupling ensures gauge invariance? What am I missing?