With the dishwasher removed from the cabinet, you will be able to reconnect the spring to the cable and reroute the cable over the pulley to the door hinge.
Pulling the dishwasher out and finding the spring lying there not connected is not uncommon, when the cable breaks the tension sends the spring flying out of position.
On the lower rear frame of the dishwasher you will see a round hole insert one end of the door spring into the hole on the rear frame and connect the cable. With the cable and spring connected you are able to pull the door cable and wrap around the pulley, having a second hand either holding the door or pulling on the spring is helpful.
Route the dishwasher cable around the pulley and connect the plastic end the door hinge. Adjusting the tension on the cable is done by removing the one screw in the pulley and rotating one position at a time until satisfied.
Often times the dishwasher cable breaks it is do to bad hinges, over time the hinges can become out of specs (bent) and the cable will rub creating friction on the cable. Replacing the hinges will fix this issue in most cases. Appliance repair companies charge in the hundreds to replace these hinges.