Sometimes middleware has a dependency on an external service, in most cases this is the resolver, but it's not limited to it.
Therefore there should be option to use middleware by their type and not only by their instance.
This requires some changes in the bootstrapping pipeline.