<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Component-Scanning on Java &amp; Software Architecture Knowledge Hub</title><link>https://samirsahoo.github.io/design-patterns-hub/tags/component-scanning/</link><description>Recent content in Component-Scanning on Java &amp; Software Architecture Knowledge Hub</description><generator>Hugo</generator><language>en-US</language><copyright>© 2026 Samir Kumar Sahoo (https://github.com/samirsahoo). All rights reserved.</copyright><atom:link href="https://samirsahoo.github.io/design-patterns-hub/tags/component-scanning/index.xml" rel="self" type="application/rss+xml"/><item><title>Spring Configuration: @Configuration, @Bean, Component Scanning and Profiles</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/core/configuration-and-component-scanning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/core/configuration-and-component-scanning/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Spring learns &lt;strong&gt;which beans to create&lt;/strong&gt; in three main ways:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Component scanning&lt;/strong&gt;: annotate your classes (&lt;code&gt;@Component&lt;/code&gt;, &lt;code&gt;@Service&lt;/code&gt; and so on) and Spring finds them.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Java configuration&lt;/strong&gt;: &lt;code&gt;@Bean&lt;/code&gt; factory methods inside &lt;code&gt;@Configuration&lt;/code&gt; classes, ideal for third-party classes you cannot annotate.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Auto-configuration&lt;/strong&gt;: Spring Boot&amp;rsquo;s conditional defaults. See &lt;a href="https://samirsahoo.github.io/design-patterns-hub/spring/boot/auto-configuration-and-conditions/"&gt;auto-configuration&lt;/a&gt;.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Without a clear configuration strategy, applications end up with duplicate beans, surprising overrides, beans scanned from the wrong packages, and environment-specific code paths scattered everywhere.&lt;/p&gt;</description></item></channel></rss>