2. Given the function $f(x)=x^{2}-2 a x+2 a+4$ with the domain $R$ and the range $[1,+\infty]$. Then the value of $a$ is ).
(A) interval $[-1,3$ ]
(B) interval $(1-\sqrt{5}, 1+\sqrt{5})$
(C) interval $(-\infty,-1) \cup(3,+\infty)$
(D) set $\{-1,3\}$
2. (D). Given $y=1$, we have $x^{2}-2 a x+2 a+4=1$. Its discriminant:
$\Delta=4\left(a^{2}-2 a-3\right)=0$. Solving this yields $a=-1$ or 3.
Note: If $\Delta \leqslant 0$ is used to calculate (A), it only ensures that the points of the parabola are not below the line $y=1$. For example, if $0 \in[-1,3]$, then $f(x)=x^{2}+4 \geqslant 4$, meaning the entire parabola is above $y=1$, but the range is $[4,+\infty)$.