Magnetic Pulls between objects

How do I add a Magnetic Pull between two game objects?

I think you may do it using

1) spring joint efficiently.

2) you may use the compound of trigger and colliders and the in OnTriggerEnter OnTriggerStay you can apply force to one object towards another.

i hope you understand what i mean.