<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dependency-Injection on Abdelbaki Ben Elhaj Slimene</title><link>https://bakic.github.io/tags/dependency-injection/</link><description>Recent content in Dependency-Injection on Abdelbaki Ben Elhaj Slimene</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Fri, 05 Mar 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://bakic.github.io/tags/dependency-injection/index.xml" rel="self" type="application/rss+xml"/><item><title>Comparison between the different ways of dependency injection in Spring</title><link>https://bakic.github.io/posts/dependency-injection-ways-in-spring/</link><pubDate>Fri, 05 Mar 2021 00:00:00 +0000</pubDate><guid>https://bakic.github.io/posts/dependency-injection-ways-in-spring/</guid><description>&lt;p&gt;&lt;img src="image-1.jpg" alt="Photo by Fazly Shah on Unsplash"&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@fazlyshah?utm_source=medium&amp;amp;utm_medium=referral"&gt;Fazly Shah&lt;/a&gt; on &lt;a href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;Dependency injection is a core feature of the Spring framework. It is used by Spring to set the bean’s dependencies while initializing the application context. We usually use &lt;code&gt;@Autowired&lt;/code&gt; annotation to get a reference to a bean in the Spring context.&lt;/p&gt;&#10;&lt;p&gt;Dependency injection in Spring can be done in three different ways: fields, setter, and constructor. In this article, we will explain each one and give their pros and cons.&lt;/p&gt;</description></item></channel></rss>