What would be the best way to add ideal springs on a continuous media (a beam for example)? A solution could be to modify one matrix corresponding to the weak formulation, but it seems to be not so easy (I must know the number of the degree of freedom corresponding to the application point).

As I understand this, the material model for a flexible beam would include
linear elasticity similar to a linear hookian spring and distribute loads
are apparently common examples. The issue is the point or delta function
loading. You want to apply the displacement dependent force at one
point or DOF. At least two problems arise, locating the single DOF and
what magnitude to apply. I had an issue before adding a line charge
to a 2D mesh and IIRC had some luck using isoline and curve or similar
but I think I used area and lenedge to get the numbers right although
I don’t think I looked too closely at the result. I guess you could also use P0
elements.

I’m not sure it is an answer so much as just attempting to clarify the issue.
I take it that is your stumbling point? For example, why can’t you just
model the spring as another beam perpendicular to the first one?