The term for the electrical component that actuated (vibrates) at a selectable frequency is "Piezoelectric actuator". You can also examine vibration motors, like in the mobile phones or in the toothbrushes, which vibrate at predefined frequencies.
However if you are allowed to pick your own spring, and/or if you can change the masses attached, you can use even a sound card or a direct impulse on the spring, or a vibration motor to generate a vibration of need.
For the piezoelectric actuator, you supply voltage and it resonates accordingly.
For the mass (or spring) changing method, you will solve some good and simple physics problems. I would recommend professor Walter Levin's lectures, which are funny and seriously great classes, available on the Internet.