diff --git a/http-handler/Abstracts/Handler.php b/http-handler/Abstracts/Handler.php index 16874267..73c181fc 100644 --- a/http-handler/Abstracts/Handler.php +++ b/http-handler/Abstracts/Handler.php @@ -2,6 +2,7 @@ namespace Http\Handler\Abstracts; +use Annotation\Inject; use Http\Handler\Handler as CHl; use Http\Message\ServerRequest; use Kiri\Core\Help; @@ -22,6 +23,9 @@ abstract class Handler implements RequestHandlerInterface protected CHl $handler; + #[Inject(AspectProxy::class)] + protected AspectProxy $aspectProxy; + protected ?array $middlewares; /** @@ -75,8 +79,8 @@ abstract class Handler implements RequestHandlerInterface */ protected function dispatcher(ServerRequestInterface $request): mixed { - $aspect = Kiri::getDi()->get(AspectProxy::class); - if (!(($response = $aspect->proxy($this->handler)) instanceof ResponseInterface)) { + $response = $this->aspectProxy->proxy($this->handler); + if (!($response instanceof ResponseInterface)) { $response = $this->transferToResponse($response); } $response->withHeader('Run-Time', $this->_runTime($request));