# Dependency Injection in Crystal

**URL:** <https://forum.crystal-lang.org/t/dependency-injection-in-crystal/1005>\
**Category:** Learning Resources\
**Created:** [July 28, 2019, 2:19pm UTC](https://forum.crystal-lang.org/t/dependency-injection-in-crystal/1005 "2019-07-28T14:19:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/blacksmoke16/32/1241_2.png) [@Blacksmoke16](https://forum.crystal-lang.org/u/Blacksmoke16)\
**Post date:** [July 28, 2019, 2:19pm UTC](https://forum.crystal-lang.org/t/dependency-injection-in-crystal/1005/1 "2019-07-28T14:19:54Z")

</div>

> **[Dependency Injection in Crystal](https://dev.to/blacksmoke16/dependency-injection-in-crystal-2d66)**
>
> Useful DI patterns with examples.

---

<div class="post-metadata">

**Author:** ![girng](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/girng/32/127_2.png) [@girng](https://forum.crystal-lang.org/u/girng)\
**Post date:** [July 28, 2019, 6:41pm UTC](https://forum.crystal-lang.org/t/dependency-injection-in-crystal/1005/2 "2019-07-28T18:41:03Z")

</div>

I commented there, and hearted the post. Thanks for the article!

---

<div class="post-metadata">

**Author:** ![straight-shoota](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/straight-shoota/32/36_2.png) [@straight-shoota](https://forum.crystal-lang.org/u/straight-shoota)\
**Post date:** [July 28, 2019, 11:48pm UTC](https://forum.crystal-lang.org/t/dependency-injection-in-crystal/1005/3 "2019-07-28T23:48:19Z")

</div>

Thank you for this really great read!

It’s great to communicate your shard with such informative articles. And it does a good job at explaining the concept of dependency injection and how to use it in with Athena. But it’s not plain Crystal or the only way to do that, so the title might be a bit misleading. But it still serves as an informative resource, even if you’re not using Athena or even Crystal.

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/blacksmoke16/32/1241_2.png) [@Blacksmoke16](https://forum.crystal-lang.org/u/Blacksmoke16)\
**Post date:** [July 28, 2019, 11:59pm UTC](https://forum.crystal-lang.org/t/dependency-injection-in-crystal/1005/4 "2019-07-28T23:59:47Z")

</div>

Thanks!

> [@straight-shoota](#):
>
> But it’s not plain Crystal or the only way to do that, so the title might be a bit misleading.

True, I mention we’ll be using Athena in the beginning. Showing all this off in pure Crystal would probably turn into more “How to implement DI in Crystal” than “How it can be used”. As its not really a trivial thing…maybe that would be a good idea for another article…

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/blacksmoke16/32/1241_2.png) [@Blacksmoke16](https://forum.crystal-lang.org/u/Blacksmoke16)\
**Post date:** [June 17, 2020, 2:45am UTC](https://forum.crystal-lang.org/t/dependency-injection-in-crystal/1005/5 "2020-06-17T02:45:57Z")

</div>

> **[Dependency Injection in Crystal](https://dev.to/blacksmoke16/dependency-injection-in-crystal-2d66)**
>
> Useful DI patterns with examples.

Updated for [Athena 0.9.0](https://forum.crystal-lang.org/t/athena-0-9-0/2235).
