Add visibility option for dependency methods

Factory methods from DepenencyContainer are usually used in a private
or protected context so it makes sense for the visiblity to be
configurable and have a sensible default (private).