'Upgraded Symfony 4.4 to 5.4 getting error "Cannot autowire service"

I recently upgraded to Symfony 5.4.*

Here is the error I am facing:

Cannot autowire service "App\Controller\V1\OrderPaymentController": argument "$mailer" of method "__construct()" references interface "App\Repository\MailingRepositoryInterface" but no such service exists. Did you create a class that implements this interface?

This error is coming when I am running the installation just after the upgrade.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source