It’s an extremely casual activity that spring, when strained will undergo the displacement when it is compacted it gets compressed. Then it comes to its equilibrium position. Thus, spring exerts an equal as well as an opposite force on a body that compresses or stretches it.