The problem is that we need one place where we created the MetadataFactory class when needed. Otherwise, we won't be able to cache the MetadataFactory class correctly without the container. So or we make the AutoRouteManager our main class, let him create the MetadataFactory and pass it to the other classes. Or we need to have a factory class for the MetadataFactory.