Dante's will was reeducated toward goodness on his journey through the levels of the after-life by encounters with spirits who told their stories at each level; by discourse with the poet Virgil; by the guidance of his beloved Beatrice; by examination by the Saints in the eighth Paradise; and by the recommended prayers of Saint Bernard.
With Virgil as his guide and beginning at shores of suffering that led to the ten lower realms, Dante began with an encountered with those being punished for having no regard for good or evil and descended through ten dank regions, ending with those who were being punished for having been traitors. In these ten regions Dante conversed with souls to learn their crimes, which worked as a profound and successful object lesson of what things to shun on Earth.
In the realm of Purgatory, Dante conversed with souls in Ante-Purgatory who likewise told him their stories so that he might avoid the same errors. In Purgatory itself, Dante visited the various cornices and saw the punishments of the committers of sins from pride to lack of moral chastity. In these cornices, Dante saw punishments ranging from dragging heavy stones to purification by indescribable heat. Along the way, the poet Virgil spoke with him about the nature of love.
In Paradise, Dante was reunited with Beatrice through his repentance, and she became his guide, giving him understanding at each of the eight levels of Paradise. At the eighth of which he was examined, or questioned, by Saints Peter, James and John. after which he had conversations with Peter and Adam. Finally, Beatrice quietly returned to her throne, and Dante was left with Saint Bernard who instructed him in how to pray. This is the process through which Dante reeducated his will toward goodness.