I had posted an answer earlier but I'm not convinced if it is right, luckily the Link I provided itself had an answer, which is summarized below
Let the spring of Young's modulus $E$, density $\rho$, with a section $S$
$E$ and $\rho$ are related by
$$E=\frac{k\rho L^2}{m}$$
$$\rho=\frac{m}{SL}$$
It is convenient to use as reference position, the spring as it would be if the gravity did not act: that
is, vertical and uniform. Let us consider two sections $S$ and $S’$ of the spring. Two points of the
spring $P$ on $S$ and $Q$ on $S‘$, at the reference positions $x$ and $x+\Delta x$, will be displaced, under the effect
of the gravity, by the quantities $y$ and $y+\Delta y $ respectively
The mass element $\Delta x $ from $P$ to $Q$ is subjected to gravity and two tensions $T$ and $T+\Delta T$
$\Delta T+\rho S g \Delta x=0$
Since the extension of the element $\Delta y$ is given by the applied force $T+\Delta T$, we have
$$T+\Delta T=SE \frac{\Delta y}{\Delta x}$$
Processing to the limit as $\Delta x→0, dT/dx = − ρSg, T = S E \frac{dy}{dx}$, we have then:
$$SE\frac{d^2 y}{dx^2}=\rho S g$$
with the boundary conditions:
$y=0$ for $x=0$, $\frac{dy}{dx}=0$ for $x=L$
That is, the tension vanishes at the lower end, this gives
$y=\frac{\rho g L}{E}x-\frac{\rho g}{2E}x^2$
so,
$$y=\frac{mg}{kL}x-\frac{mg}{2kL^2}x^2$$
for $x=\frac{L}{2}$ i.e for the center
$y=\frac{3mg}{8k}$
So the center of mass will be at the point $$\frac{L}{2}+\frac{3mg}{8k}$$