Brake Light Switch?

I noticed recently that my brake lights would come on when the car was parked. I assume it's the brake light switch and have pulled the pedal up to engage it but it inevitable happens again. I ordered a new switch over the weekend but was wondering if it might be the pedal. I haven't looked at the pedal workings but was wondering if a spring might be the culprit/ Does the pedal have a spring to keep it tight against the switch?