Facing issue when passing ContainerInterface in constructor of controller class

Guys I am new in slim framework. Iam creating a controller class and read in documentation i have read when slim create controller object it passes ‘ContainerInterface’ as argument automatically. But I am facing this is exception.

Argument 1 passed to OurOwnNamespace\Controller\Test::__construct() must be an instance of Psr\Container\ContainerInterface, null given, called in /Applications/XAMPP/xamppfiles/htdocs/slim/vendor/slim/slim/Slim/CallableResolver.php on line 149

Here is my controller code:

<?php
namespace OurOwnNamespace\Controller;
use Psr\Container\ContainerInterface;

class Test
{
    protected $con;

    public function __construct(ContainerInterface $container)
    {
        $this->con=$container;
    }

    public function hello($request,$response,$args){

        return $response;
    }
}

Here is my route:

$app->get('/', Test::class . ':hello');

Here documentation says if the class does not have an entry in the container, then Slim will pass the container’s instance to the constructor.

Hi @mianaliasjad, i also faced the same issue but i got it resolved by following this steps
https://akrabat.com/dependency-injection-in-slim-4/