<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Saravana on Medium]]></title>
        <description><![CDATA[Stories by Saravana on Medium]]></description>
        <link>https://medium.com/@imSarkie?source=rss-b99dde55b939------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qzrDC1HyB7Pa4x2S0tS0qw.jpeg</url>
            <title>Stories by Saravana on Medium</title>
            <link>https://medium.com/@imSarkie?source=rss-b99dde55b939------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:04:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@imSarkie/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[@Configuration vs @Component in Spring: A Subtle But Critical Difference]]></title>
            <link>https://medium.com/@imSarkie/configuration-vs-component-in-spring-a-subtle-but-critical-difference-80a5fd6bc306?source=rss-b99dde55b939------2</link>
            <guid isPermaLink="false">https://medium.com/p/80a5fd6bc306</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[spring]]></category>
            <dc:creator><![CDATA[Saravana]]></dc:creator>
            <pubDate>Tue, 21 Apr 2026 04:36:18 GMT</pubDate>
            <atom:updated>2026-04-21T04:36:18.659Z</atom:updated>
            <content:encoded><![CDATA[<h4>Configuring Beans — SpringBoot</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s3bsREHNnIZa8JkV" /><figcaption>Photo by <a href="https://unsplash.com/@lucabravo?utm_source=medium&amp;utm_medium=referral">Luca Bravo</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you’ve ever swapped @Configuration for @Component on a Spring config class and thought “it’s basically the same thing” — this article is for you. They’re not the same. And the difference can silently break your application in ways that are hard to debug.</p><p>Let’s walk through a real example.</p><h3>Sample setup for example:</h3><p>We have a simple payment system with two implementations of a PaymentService interface:</p><pre>public interface PaymentService {<br>    void pay(double amount);<br>}<br><br>public class PaypalPaymentService implements PaymentService {<br>    public void pay(double amount) {<br>        System.out.println(&quot;PAYPAL\nAmount: &quot; + amount + &quot; paid.&quot;);<br>    }<br>}<br><br>public class StripePaymentService implements PaymentService {<br>    public void pay(double amount) {<br>        System.out.println(&quot;STRIPE\nAmount: &quot; + amount + &quot; paid.&quot;);<br>    }<br>}</pre><p>And an OrderService That depends on whichever PaymentService is active:</p><pre>public class OrderService {<br>    private final PaymentService paymentService;<br><br>    public OrderService(PaymentService paymentService) {<br>        this.paymentService = paymentService;<br>    }<br><br>    public void placeOrder(double amount) {<br>        paymentService.pay(amount);<br>    }<br>}</pre><p>The configuration reads which payment provider to use from application.yaml:</p><pre>payment:<br>  service:<br>    default: stripe</pre><h3>The Config Class:</h3><pre>@Configuration<br>public class AppConfig {<br><br>    @Value(&quot;${payment.service.default}&quot;)<br>    private String paymentDefault;<br><br>    @Bean<br>    public PaymentService paymentService() {<br>        if (paymentDefault.equals(&quot;paypal&quot;)) {<br>            return new PaypalPaymentService();<br>        } else {<br>            return new StripePaymentService();<br>        }<br>    }<br><br>    @Bean<br>    public OrderService orderService() {<br>        return new OrderService(paymentService()); // calling paymentService() directly<br>    }<br>}</pre><p>Here you can notice that orderService() calls paymentService() directly as a Java method and not through injection. This is the line that behaves completely differently depending on whether you use @Configuration or @Component .</p><h3>How @Configuration Works (The Right Way):</h3><p>When you annotate a class with @ConfigurationSpring enhances it at runtime using a CGLIB proxy. This proxy ensures that @Bean methods behave correctly.</p><p>Instead of calling @Bean methods directly; the proxy intercepts each call. This allows Spring to enforce singleton behavior (or other scopes), even when one @Bean method calls another within the same class.</p><p>In simple terms, what looks like a normal method call is actually redirected to the Spring container, which returns the already managed bean instead of creating a new instance.</p><p>(<em>I’ll dive deeper into Spring Boot internals (like CGLIB proxy) as I continue learning as well.</em>)</p><p>To verify this, add identity hash prints:</p><p>(<em>An </em><strong><em>identity hash</em></strong><em> (often seen via something like </em><em>System.identityHashCode(obj) in Java) is a number that represents the </em><strong><em>identity of an object</em></strong>)</p><pre>@Bean<br>public PaymentService paymentService() {<br>    PaymentService service = paymentDefault.equals(&quot;paypal&quot;)<br>            ? new PaypalPaymentService()<br>            : new StripePaymentService();<br>    System.out.println(&quot;[paymentService bean] instance hash: &quot; + System.identityHashCode(service));<br>    return service;<br>}<br><br>@Bean<br>public OrderService orderService() {<br>    PaymentService serviceForOrder = paymentService();<br>    System.out.println(&quot;[orderService -&gt; paymentService()] instance hash: &quot; + System.identityHashCode(serviceForOrder));<br>    return new OrderService(serviceForOrder);<br>}</pre><p><strong>Output with </strong><strong>@Configuration:</strong></p><pre>[paymentService bean] instance hash: 777113684<br>[orderService -&gt; paymentService()] instance hash: 777113684</pre><p>paymentService() It is called <strong>once</strong>. The CGLIB proxy intercepts the second call from orderService() and returns the existing singleton. Both references point to the <strong>same object</strong>.</p><h3>What Happens With @Component (The Trap):</h3><p>Now swap @Configuration for @Component:</p><pre>@Component  // ← changed<br>public class AppConfig {<br>    // ... same code<br>}</pre><p>When you replace @Configuration with @ComponentSpring stops enhancing the class with a CGLIB proxy, so it behaves like a normal Java class.</p><ul><li>Spring <strong>does NOT intercept</strong> @Bean method calls</li><li>So when orderService() calls paymentService()<br> → It’s just a <strong>direct method call</strong><br> → the method runs <strong>again like normal Java</strong></li></ul><p>That means: A new object is created each time the method is called.</p><p>Output with @Component:</p><pre>[paymentService bean] instance hash: 777113684<br>[paymentService bean] instance hash: 1081635795<br>[orderService -&gt; paymentService()] instance hash: 1081635795</pre><p>Three lines. paymentService() printed <strong>twice</strong>, proof it ran twice.</p><p>Let’s break it down:</p><p><strong>First line</strong></p><ul><li>Spring calls paymentService() to create the bean</li><li>Instance created → 777113684</li></ul><p><strong>Second line</strong></p><ul><li>Somewhere else (like another bean setup), paymentService() is called again</li><li>Since there’s no proxy → method runs again</li><li>New instance → 1081635795</li></ul><p><strong>Third line</strong></p><ul><li>Inside orderService(), you call paymentService()</li><li>Again, a <strong>direct method call</strong></li><li>It creates (or reuses within that call path) the same new instance → 1081635795</li></ul><p>OrderService is wired with a PaymentServiceObject that Spring knows absolutely nothing about.</p><h3>Why This Is Dangerous</h3><p>In this sample example, the app still works, StripePaymentService It is a plain class with no Spring dependencies, so the unmanaged instance behaves the same as the managed one.</p><p>But in a real application, your services often carry Spring-managed behaviour:</p><ul><li><strong>@Transactional</strong> — Spring applies transactions through a proxy. An unmanaged instance bypasses this entirely. Your database operations won’t be wrapped in a transaction.</li><li><strong>@Cacheable</strong> — Caching is applied through a proxy. The unmanaged instance will never cache anything.</li><li><strong>@Async</strong> — Asynchronous execution won’t work on an unmanaged instance.</li></ul><p>These failures are <strong>silent</strong>. Your application starts, runs, and logs no errors. You only discover the problem when transactions aren’t rolling back, or caches aren’t being hit.</p><p>The safest general rule: <strong>always use </strong><strong>@Configuration for classes that define </strong><strong>@Bean methods.</strong></p><p>The difference between @Configuration and@Component It&#39;s not just a label… it changes how Spring manages your object graph at a fundamental level. One small annotation swap can introduce a bug that’s invisible until it causes real damage in production.</p><p>Follow for more content like this.</p><p><em>Used AI to refine the content. The concepts in this article are based on my own understanding and hands-on exploration, but it’s always best to try things out yourself.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80a5fd6bc306" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Today I Didn’t Write.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@imSarkie/today-i-didnt-write-ec89b5a6cb57?source=rss-b99dde55b939------2"><img src="https://cdn-images-1.medium.com/max/600/1*6KIaaA7QwBOG2QugO9VCsg.png" width="600"></a></p><p class="medium-feed-snippet">I read a blog that stayed with me, and I&#x2019;m still sitting with it&#x2026; It feels enough.</p><p class="medium-feed-link"><a href="https://medium.com/@imSarkie/today-i-didnt-write-ec89b5a6cb57?source=rss-b99dde55b939------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@imSarkie/today-i-didnt-write-ec89b5a6cb57?source=rss-b99dde55b939------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec89b5a6cb57</guid>
            <category><![CDATA[reading]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[poetry]]></category>
            <category><![CDATA[love]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Saravana]]></dc:creator>
            <pubDate>Thu, 12 Feb 2026 17:13:57 GMT</pubDate>
            <atom:updated>2026-02-12T17:13:57.969Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Change Can Be Scary, But We’ll Be Ok.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@imSarkie/change-can-be-scary-but-well-be-ok-08c18885e42e?source=rss-b99dde55b939------2"><img src="https://cdn-images-1.medium.com/max/2600/0*fz5C6sYdGpAv2Df8" width="6000"></a></p><p class="medium-feed-snippet">Change can feel unfamiliar and unsettling, but it shapes our growth, teaching us resilience, trust, and the courage to believe that we&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@imSarkie/change-can-be-scary-but-well-be-ok-08c18885e42e?source=rss-b99dde55b939------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@imSarkie/change-can-be-scary-but-well-be-ok-08c18885e42e?source=rss-b99dde55b939------2</link>
            <guid isPermaLink="false">https://medium.com/p/08c18885e42e</guid>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[reflections]]></category>
            <category><![CDATA[change]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Saravana]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 14:23:48 GMT</pubDate>
            <atom:updated>2026-02-11T14:23:48.674Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Walking Away From Everything.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@imSarkie/walking-away-from-everything-76a8dc421275?source=rss-b99dde55b939------2"><img src="https://cdn-images-1.medium.com/max/2600/0*WOmJgpTFirDG4lty" width="4785"></a></p><p class="medium-feed-snippet">Letting go of outcomes, expectations, and control can end suffering, deepen love, sharpen focus, and help you finally live fully in the&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@imSarkie/walking-away-from-everything-76a8dc421275?source=rss-b99dde55b939------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@imSarkie/walking-away-from-everything-76a8dc421275?source=rss-b99dde55b939------2</link>
            <guid isPermaLink="false">https://medium.com/p/76a8dc421275</guid>
            <category><![CDATA[suffering]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[detachment]]></category>
            <category><![CDATA[personal-development]]></category>
            <dc:creator><![CDATA[Saravana]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 05:07:42 GMT</pubDate>
            <atom:updated>2026-02-10T05:07:42.817Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Bee Flies Anyway.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@imSarkie/bee-flies-anyway-b4914857f412?source=rss-b99dde55b939------2"><img src="https://cdn-images-1.medium.com/max/2600/0*jCy7gjjMA3sNe9kg" width="3456"></a></p><p class="medium-feed-snippet">I fly anyway, even when I don&#x2019;t trust myself, believing the process will shape my strength.</p><p class="medium-feed-link"><a href="https://medium.com/@imSarkie/bee-flies-anyway-b4914857f412?source=rss-b99dde55b939------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@imSarkie/bee-flies-anyway-b4914857f412?source=rss-b99dde55b939------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4914857f412</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[writing]]></category>
            <dc:creator><![CDATA[Saravana]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 05:27:05 GMT</pubDate>
            <atom:updated>2026-02-09T05:27:05.214Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[I Failed at Productivity, and I’m Not Ashamed of It.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@imSarkie/i-failed-at-productivity-and-im-not-ashamed-of-it-6cbc5c190e3d?source=rss-b99dde55b939------2"><img src="https://cdn-images-1.medium.com/max/2600/0*UVMA0NWg4hkHDTfm" width="5472"></a></p><p class="medium-feed-snippet">Why rigid schedules suffocate creativity, slow work matters, and I choose patience over performance, metrics, and modern productivity&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@imSarkie/i-failed-at-productivity-and-im-not-ashamed-of-it-6cbc5c190e3d?source=rss-b99dde55b939------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@imSarkie/i-failed-at-productivity-and-im-not-ashamed-of-it-6cbc5c190e3d?source=rss-b99dde55b939------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cbc5c190e3d</guid>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[art]]></category>
            <dc:creator><![CDATA[Saravana]]></dc:creator>
            <pubDate>Sun, 08 Feb 2026 04:43:27 GMT</pubDate>
            <atom:updated>2026-02-08T04:43:27.439Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[I Won’t Publish Everything I Write.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@imSarkie/i-wont-publish-everything-i-write-aeab94e5c2f4?source=rss-b99dde55b939------2"><img src="https://cdn-images-1.medium.com/max/2600/0*jiusnJDAo5Mct-1o" width="5184"></a></p><p class="medium-feed-snippet">A reflection on private writing, staying in the moment, and why the most honest words sometimes belong only to pen, paper, and the person&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@imSarkie/i-wont-publish-everything-i-write-aeab94e5c2f4?source=rss-b99dde55b939------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@imSarkie/i-wont-publish-everything-i-write-aeab94e5c2f4?source=rss-b99dde55b939------2</link>
            <guid isPermaLink="false">https://medium.com/p/aeab94e5c2f4</guid>
            <category><![CDATA[personal]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[self]]></category>
            <category><![CDATA[reflections]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Saravana]]></dc:creator>
            <pubDate>Sat, 07 Feb 2026 05:27:03 GMT</pubDate>
            <atom:updated>2026-02-07T05:27:03.679Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Efficiency with Ethics]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@imSarkie/efficiency-with-ethics-c961cacfad86?source=rss-b99dde55b939------2"><img src="https://cdn-images-1.medium.com/max/2600/0*yTIahFRunh9Snx1a" width="7952"></a></p><p class="medium-feed-snippet">A reflection on graduation, a powerful speech, and why the values behind what we build matter more than the speed at which we build them.</p><p class="medium-feed-link"><a href="https://medium.com/@imSarkie/efficiency-with-ethics-c961cacfad86?source=rss-b99dde55b939------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@imSarkie/efficiency-with-ethics-c961cacfad86?source=rss-b99dde55b939------2</link>
            <guid isPermaLink="false">https://medium.com/p/c961cacfad86</guid>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[reflections]]></category>
            <category><![CDATA[work]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Saravana]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 08:18:59 GMT</pubDate>
            <atom:updated>2026-02-06T08:18:59.005Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[The Imitation Game.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@imSarkie/the-imitation-game-9011d47bdbb2?source=rss-b99dde55b939------2"><img src="https://cdn-images-1.medium.com/max/2600/0*5gskNfyV-46T_-wi" width="4770"></a></p><p class="medium-feed-snippet">A personal lesson on how imitating master writers builds clarity, improves thinking, and helps beginners find their unique voice through&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@imSarkie/the-imitation-game-9011d47bdbb2?source=rss-b99dde55b939------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@imSarkie/the-imitation-game-9011d47bdbb2?source=rss-b99dde55b939------2</link>
            <guid isPermaLink="false">https://medium.com/p/9011d47bdbb2</guid>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[writing-tips]]></category>
            <dc:creator><![CDATA[Saravana]]></dc:creator>
            <pubDate>Thu, 05 Feb 2026 00:26:00 GMT</pubDate>
            <atom:updated>2026-02-05T00:26:00.807Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Being Curious in Chaos.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@imSarkie/being-curious-in-chaos-5d8de145fafa?source=rss-b99dde55b939------2"><img src="https://cdn-images-1.medium.com/max/2600/0*lpWdgxx5vhKrYAWJ" width="4000"></a></p><p class="medium-feed-snippet">Finding space to think deeply in a world of instant answers, dopamine rewards, constant noise, and distractions that slowly distance us&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@imSarkie/being-curious-in-chaos-5d8de145fafa?source=rss-b99dde55b939------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@imSarkie/being-curious-in-chaos-5d8de145fafa?source=rss-b99dde55b939------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d8de145fafa</guid>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[curiosity]]></category>
            <dc:creator><![CDATA[Saravana]]></dc:creator>
            <pubDate>Wed, 04 Feb 2026 05:29:01 GMT</pubDate>
            <atom:updated>2026-02-04T05:29:01.841Z</atom:updated>
        </item>
    </channel>
</rss>