Would a cam do? Put a cam on the motor shaft that will push against a plate that the spring is attached to, moving it up and down. PWM to control the motor. I assume you want to drive the spring AT the resonant frequency, which could be as simple as figuring out what that frequency is then driving the motor at that RPM, or more complex using a linear encoder on the spring to determine how it's moving, and control that way.
Any thoughts?
MIKE