使用Symfony 4和php7.2尝试使用LoginFormAuthenticator(https://knpuniversity.com/screencast/symfony-security)并更新到Symfony 4(https://symfony.com/doc/current/security/guard_authentication.html)无论我做什么,似乎依赖注入对我不起作用 . 从文档中看起来很简单:在config / services.yaml中使用autowire,在LoginFormAuthenticator.php文件中输入use语句,将Type Hint参数放在构造函数中

public function _construct(FormFactoryInterface $formFactory)
{
    $this->formFactory = $formFactory;
}

public function supports(Request $request)
{
    var_dump($this->formFactory);
}

var_dump给出NULL

试图在$ this-> formFactory上调用方法会给出错误消息:

在null上调用成员函数xyz

试过autowire并尝试使用参数但没有成功 .

有什么建议?