Registers a provider for type. It overwrites any provider registered for the same type with this method.