It's possible to backport into an older Symfony project the new feature for Symfony 7.3
that automatically register classes declaring #[Route]
attribute for injection of services
into the controller.
You need to update your App\Kernel
class to register the attribute autoconfiguration.