My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Dependency Injection makes swapping dependencies easy

Ben Goosman's photo
Ben Goosman
·Mar 25, 2020

I was integrating a chatbot, had everything merged, and was feeling ready to being UAT in production when I was made aware that we needed to use a different version of that chatbot. Since the other version used the same interface as the one I was using, and I was using Dependency Injection to inject the chatbot, all I had to do was swap the object I was passing in.