We know that a stretched spring obeys Hooke's law, such that $F=-kx$

We can find the potential energy of stretching/compressing this spring by x, given by :

${U}_{x}-{U}_{0}=-{\int}_{0}^{x}F.dx=\frac{1}{2}k{x}^{2}$

Setting ${U}_{0}=0$ as reference, we have ${U}_{x}=\frac{1}{2}k{x}^{2}$

However, this is also sometimes described as the work done by the spring.

Shouldn't the work done W be given by $\int F.dr$, such that $W=-\mathrm{\Delta}U=-\frac{1}{2}k{x}^{2}$ in this case ?

Isn't the work done by the spring negative ?

Also, in this case the potential energy comes to be negative.. In general, can we set any point as reference and set it to be 0 and perform the integral between any two limits, to get either a positive or a negative U ?

For example, in forces of the nature ${r}^{-n},(n>1)$ we usually take the reference at $r=\mathrm{\infty}$ and integrate from $\mathrm{\infty}$ to some point r. In case of forces of the nature ${r}^{n}$, we usually take 0 as the reference and integrate from 0 to some r. In general, we are free to choose any reference and any limit, even though some are much more convenient, right ? In theory, we can choose any point, right ?

As long as we have :

${U}_{a}-{U}_{b}=-{\int}_{b}^{a}F.dx$

we can choose any a and b, and set either of ${U}_{a}$ or ${U}_{b}$ to be the reference and equal to 0, right ?