code for training of spring