<?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 Suriya on Medium]]></title>
        <description><![CDATA[Stories by Suriya on Medium]]></description>
        <link>https://medium.com/@suriyaprakhash?source=rss-89fe0cf04a67------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6ceA0rhcQSFf90tvKivkiQ.jpeg</url>
            <title>Stories by Suriya on Medium</title>
            <link>https://medium.com/@suriyaprakhash?source=rss-89fe0cf04a67------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 08:01:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@suriyaprakhash/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[Gradle 101: Behind the scene]]></title>
            <link>https://medium.com/javarevisited/gradle-101-behind-the-scene-4d56b88b274e?source=rss-89fe0cf04a67------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d56b88b274e</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[maven]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[gradle]]></category>
            <dc:creator><![CDATA[Suriya]]></dc:creator>
            <pubDate>Mon, 23 Mar 2026 15:32:05 GMT</pubDate>
            <atom:updated>2026-03-23T15:32:05.413Z</atom:updated>
            <content:encoded><![CDATA[<h4>From javac to gradle build</h4><p>I always felt that the engineers I talk to, who have been using Gradle for a while now, they know the syntax, structure but I always felt like they were missing the very basics for example,</p><ul><li>Why do I need to add the pluginRepository block before plugins?</li><li>What does a plugin do?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UVHMU12bdCs6xSZH" /><figcaption>Photo by <a href="https://unsplash.com/@randyfath?utm_source=medium&amp;utm_medium=referral">Randy Fath</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>And in this article we are going to check, see rather than the syntax and how to use it — we would see why are we doing it that way?</p><ul><li><a href="#0d43">Why do we need a build tool?</a></li><li><a href="#a209">Executable &amp; Structure</a></li><li><a href="#7387">Building blocks</a></li><li><a href="#0356">How do I read em?</a></li><li><a href="#8560">Task Action</a></li><li><a href="#621a">Cache Management</a></li><li><a href="#aa64">Who runs the show?</a></li><li><a href="#4fbd">Tracking dependencies</a></li><li><a href="#ff87">Enforcing standards</a></li><li><a href="#7bc0">Maven vs Gradle</a></li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DpBnSePXWjks&amp;type=text%2Fhtml&amp;schema=youtu&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FpBnSePXWjks" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd83df8ffb0cbec675e5e9ea4d832257/href">https://medium.com/media/cd83df8ffb0cbec675e5e9ea4d832257/href</a></iframe><h3>Why do we need a build tool?</h3><p>Let’s say we don’t have a build tool, how are we going to build a Java artifact?</p><p>Let’s start with a single file, like how we have at school, so we have Application.java, then we would compile this application file using javac,</p><pre>javac Application.java</pre><p>which would then spit out the intermediate class file Application.class, which we will use the java command to run as in like,</p><pre>java Application</pre><p>What if, if we got multiple files, we would then have to line em up, and execute them same as above.</p><p>Now we also have to update the manifest file to tell it where the main method class is. If at all if we are using any dependency then we might also need to add them, and not to forget the transitive dependencies too.</p><p>Where do I add my resources?.</p><p>What if we need to add sources and javadocs to it?</p><p>The list goes on and on making it a long list of items that we need to take care of manually.</p><p>Isn’t?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qlvc5cKvPTATPttc" /><figcaption>Photo by <a href="https://unsplash.com/@milenatrifonova?utm_source=medium&amp;utm_medium=referral">Milena Trifonova</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>What about if, there is something that does all this thing with a single command, tada there you go, the need for a build tool is born. And Gradle is one among them.</p><h3>Executable &amp; Structure</h3><p>First and foremost is that the gradle is a software so it needs some sort of executable file that could run on our machine.</p><p>So to start with, we would need to <a href="https://gradle.org/releases/">download the gradle</a> from gradle’s website.</p><p>Once downloaded and exported to path, we could run,</p><pre>gradle init</pre><p>and follow the prompt to create a java or kotlin project, this will create a new gradle project.</p><blockquote><strong>Side note: </strong>If you are getting started choose Kotlin DSL instead of Groovy, we will cover why down the line in this article.</blockquote><p>Here is how, the structure of the gradle project would look like,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*EgG-AdO6r-XAKZc5ftcykw.png" /><figcaption><a href="https://docs.gradle.org/current/userguide/organizing_gradle_projects.html">Gradle Kotlin project structure</a></figcaption></figure><p>Don’t worry about what is in it, we will get there by the end of this article.</p><p>Now you would add the java code in <strong>src</strong> folder and to compile and build it, you would run,</p><pre>gradle build</pre><p>Now you can share the repo with the team. They just need to do gradle build to build the project.</p><p>Pretty simple isn’t?.</p><p>But what about the rest, I know you got lot of questions? How about adding dependencies? How would I run the application?</p><p>Hold your horses.</p><h4>Gradle wrapper</h4><p>Now, let’s say the someone whom you shared the code with is using a different version of gradle in their machine, which doesn’t support your source code. So, they would need the same version as you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*byoLuB0tOhaGatnz" /><figcaption>Photo by <a href="https://unsplash.com/@aginsbrook?utm_source=medium&amp;utm_medium=referral">Anthony Fomin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>How to coordinate? Tada, the need for <a href="https://docs.gradle.org/current/userguide/gradle_wrapper.html">gradle wrapper</a> is born, where you specifically state the gradle version that you want to use for the source code in the gradle folder’s gradle property file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eRURL895wmJGBHGVrlKZyw.png" /></figure><p>Now whenever we share the source code with others or in the pipeline, when they/it would use the <a href="https://docs.gradle.org/current/userguide/gradle_wrapper.html">gradle wrapper</a> to run any of the tasks, it is going to download the respective version specified in a gradle property file for that particular source code repository that way maintaining the same gradle version to be used across the board for that particular project/repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*EAduhpWFDdHEqZjtWpM-AQ.png" /></figure><h3>Building blocks</h3><p>Now we know that, this executable or wrapper is going to run something but what is it going to run?</p><p>It is going to run a set of instructions collectively called a task.</p><h4>Tasks</h4><p>The task is the basic building block of Gradle. You might have been already using it in your gradle projects - tasks such as compile, build, jar, test, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uu2Ob6Z6-LBGbI05" /><figcaption>Photo by <a href="https://unsplash.com/@thomasbormans?utm_source=medium&amp;utm_medium=referral">Thomas Bormans</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Each one of these tasks have a piece of code that tells what the task would do.</p><p>Say for example, compile all the Java files into class files.</p><h4>How are these tasks written?</h4><p>There needs to be some sort of syntax or a language to write these instructions or commands, isn’t?</p><p>Yes!. So there comes the need for <a href="https://groovy-lang.org/">Groovy</a> or <a href="https://docs.gradle.org/current/userguide/kotlin_dsl.html">Kotlin</a> DSL(Domain Specific Language).</p><p>Say for eg. if I had to clean up the <strong><em>temp</em></strong> folder with in my root directory,</p><p>In Kotlin DSL the same would look like,</p><pre>tasks.register&lt;Delete&gt;(&quot;cleanTemp&quot;) {<br>    group = &quot;cleanup&quot;<br>    description = &quot;Deletes the temp folder&quot;<br><br>    // Deletes &#39;temp&#39; folder in the root directory<br>    delete(layout.projectDirectory.dir(&quot;temp&quot;))<br>}</pre><p>In Groovy,</p><pre>tasks.register(&#39;cleanTemp&#39;) {<br>    group = &#39;cleanup&#39;<br>    description = &#39;Deletes the temp folder&#39;<br><br>    // Deletes &#39;temp&#39; folder in the root directory<br>    delete &#39;temp&#39;<br>}</pre><p>here, <strong>Delete</strong> is an in-built gradle task that takes a path as in param to delete, so i can run this task as in</p><pre>./gradlew cleanTemp</pre><p>Viola! there you go, my first custom task!</p><blockquote><strong>Side Note </strong>Prefer using Kotlin DSL as it is statically typed and is the recommended approach for newer since <a href="https://docs.gradle.org/current/userguide/best_practices_general.html#use_kotlin_dsl">Gradle 8</a></blockquote><h4>Plugins</h4><p>A single task typically can only do one particular thing such that it makes it easier to maintain, in which case we might end up creating multiple of these and we would need some sort of organization mechanism to group them or to refer them collectively as in like a container bucket, isn’t?</p><p>You guessed it, that container is the <a href="https://plugins.gradle.org/">plugin</a>.</p><blockquote><strong>Side Note </strong>The plugin in Gradle is different from what a plugin is in Maven</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hvwF1Rtfcu8BvPim" /><figcaption>Photo by <a href="https://unsplash.com/@diegosmarines?utm_source=medium&amp;utm_medium=referral">Diego Marín</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Gradle comes with the default plugin such as <a href="https://docs.gradle.org/current/userguide/java_plugin.html">Java</a>, <a href="https://docs.gradle.org/current/userguide/application_plugin.html">Application</a>, <a href="https://docs.gradle.org/current/userguide/java_library_plugin.html">Java library</a>. some familiar third party plugins such as <a href="https://plugins.gradle.org/plugin/org.springframework.boot">spring boot</a>, <a href="https://docs.gradle.org/current/userguide/pmd_plugin.html">PMD</a>, <a href="https://plugins.gradle.org/plugin/com.diffplug.gradle.spotless">spotless</a>, etc. where they bring in tasks corresponding to their use case.</p><pre>plugins {<br>    id(&quot;java&quot;) <br>    id(&quot;com.diffplug.gradle.spotless&quot;) version &quot;8.3.0&quot;<br>}</pre><blockquote><strong>Tip </strong>The preferred way is to use the above plugin api and not use <strong>buildscript</strong></blockquote><p>Now that we know the basic two blocks that make up these let try to connect the dots,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i6JMpbBlYgR7IZzl" /><figcaption>Photo by <a href="https://unsplash.com/@alvarordesign?utm_source=medium&amp;utm_medium=referral">Alvaro Reyes</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The following will print all the tasks,</p><pre>./gradlew tasks</pre><blockquote><strong>Tip</strong> Find unused lib — build health plugin — <a href="https://github.com/autonomousapps/dependency-analysis-gradle-plugin">https://github.com/autonomousapps/dependency-analysis-gradle-plugin</a></blockquote><h4>How do I find where these tasks are coming from?</h4><p>As an end user, working on an application that’s using these plugins, it might bring in a lot of tasks and it might throw us off, and for us to know which plugin is bringing in what tasks we would need to run the following,</p><pre>./gradlew help --task build</pre><h4>Order of execution — Task Dependency/Dependency mechanism</h4><p>So these tasks from different plugin cannot be executed all at once, isn’t it? there needs to be some sort of order in which these needs executed isn’t it?.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TJdiZcbaD390R2iJ" /><figcaption>Photo by <a href="https://unsplash.com/@kovalskihelga?utm_source=medium&amp;utm_medium=referral">Olga Kovalski</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>For example, it cannot run the <strong>test</strong> or make the <strong>jar</strong> without compiling using <strong>compile</strong> task. That’s where the use of dependency mechanisms such as <strong>finalizedBy, mustRunAfter, shouldRunAfter, dependsOn</strong> are used to help gradle arrange in which order the task would get executed.</p><blockquote><strong>Side Note </strong>Don’t get confused with doLast, doFirst and other hooks as they are not part of the dependency mechanism..</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zowVbCcieHDQLZHETMivPA.png" /><figcaption>A sample direct acyclic graph (DAG) of tasks</figcaption></figure><p>This sort of forms a direct acyclic graph of tasks that needs to be executed one after the other.</p><h4>Project</h4><p>All these reside within something called a <a href="https://docs.gradle.org/current/userguide/part1_gradle_init.html">project</a>. Gradle also supports having some projects within a big project making it a <a href="https://docs.gradle.org/current/userguide/multi_project_builds.html#multi_project_layout">multi-project gradle build</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*Xyr5mMrKCZ2TdtfTKZcwSQ.png" /></figure><p>However everything starts with the root project,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*KEl_MfTUOFaSEeoXurXm3Q.png" /><figcaption><strong><em>TaskContainer </em></strong><em>for task in </em><strong><em>org.gradle.api.Project </em></strong><em>— behind the scene</em></figcaption></figure><p>Is that all in the project? Not yet. There are dependencies, repositories, extra, extension, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*R1-33sp5axGBFMBR5Z_bhQ.png" /><figcaption><strong>Repositories</strong> and <strong><em>Dependencies</em></strong> as method invoked from <strong>build.gradle<em> </em></strong><em>— behind the scene</em></figcaption></figure><h4>Dependencies</h4><p>Dependencies refers to a list of libraries that project is depending upon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rmM8G0ufmWluTWPy" /><figcaption>Photo by <a href="https://unsplash.com/@jaysung?utm_source=medium&amp;utm_medium=referral">Jehyun Sung</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Configuration aka Scope </strong>specifies whether a dependency needs to be available during the runtime (runtimeOnly), compile time (implementation) or would be consumed by a consuming application if it is a library (api) etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*h303BeF3uWxNPiWZ_AFWow.png" /><figcaption>Sample <strong><em>build.gradle</em></strong> file</figcaption></figure><h4>Repositories</h4><p>And <strong><em>repositories</em></strong> represent where to look for these libraries like from the <a href="https://central.sonatype.com/"><strong><em>mavenCentral</em></strong></a><strong><em>, mavenLocal </em></strong>or from a custom repository. However, the ideal way to do it is in the <a href="https://docs.gradle.org/current/javadoc/org/gradle/api/initialization/resolve/DependencyResolutionManagement.html"><strong><em>dependencyResolutionManagement</em></strong></a><strong><em> </em></strong>in the <strong><em>settings.gradle</em></strong> so that you don’t have to specify them in each one of the individual sub-project in a <a href="https://docs.gradle.org/current/userguide/multi_project_builds.html#multi_project_layout">multi-project</a> setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zx7KXj8h96N19v3Q" /><figcaption>Photo by <a href="https://unsplash.com/@albertorodriguez?utm_source=medium&amp;utm_medium=referral">Alberto Rodríguez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Extra</h4><p>It represents <a href="https://docs.gradle.org/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html">a project property</a> that a task might need, for example, you might have the name as a dynamic variable to your custom tasks that prints hello name. But note it acts like a global property.</p><pre>// build.gradle.kts<br><br>// Define the global variable using &#39;extra&#39;<br>// In Groovy this is &#39;ext&#39;, in Kotlin it&#39;s &#39;extra&#39;<br>val folderToClean: String by extra(&quot;youtube&quot;)<br><br>tasks.register&lt;Delete&gt;(&quot;cleanTemp&quot;) {<br>    group = &quot;cleanup&quot;<br>    description = &quot;Deletes the temp folder&quot;<br><br>    // Use the delegated property directly<br>    delete(layout.projectDirectory.dir(folderToClean))<br>}</pre><blockquote><strong>Tip </strong><em>Avoid extra and prefer using gradle.properties, </em><a href="#70da"><em>extentions</em></a><em>, </em><a href="#0cfb"><em>version catalog</em></a><em> instead where possible.</em></blockquote><h4>Extension</h4><p>What happens when you got the same variable extra name as the one used in another plugin?</p><p>That’s where <a href="https://docs.gradle.org/current/userguide/part2_add_extension.html">extensions</a> come handy as they are scoped variable. If two different tasks use the same variable name then it would be confusing isn’t? that’s why extension creates a name-spaced closure helping to define the same variable name within two different tasks.</p><pre>// build.gradle.kts<br><br>val folderToClean: String by extra(&quot;temp&quot;)<br><br>tasks.register&lt;Delete&gt;(&quot;cleanTemp&quot;) {<br>    group = &quot;cleanup&quot;<br>    description = &quot;Deletes the temp folder&quot;<br><br>    // Use the delegated property directly<br>    delete(layout.projectDirectory.dir(folderToClean))<br>}<br><br>extra.set(&quot;folderToClean&quot;, &quot;youtube&quot;)<br><br>// another cleanUp<br><br>val folderToClean: String by extra(&quot;temp&quot;)<br><br>tasks.register&lt;Delete&gt;(&quot;cleanAnotherTemp&quot;) {<br>    group = &quot;cleanup&quot;<br>    description = &quot;Deletes the temp folder&quot;<br><br>    // Use the delegated property directly<br>    delete(layout.projectDirectory.dir(folderToClean))<br>}<br><br>extra.set(&quot;folderToClean&quot;, &quot;youtube&quot;)</pre><p>This will then change to,</p><pre><br>// 1. Define a simple configuration container<br>interface CleanupConfig {<br>    val normalFolder: Property&lt;String&gt;<br>}<br><br>interface AnotherCleanupConfig {<br>    val normalFolder: Property&lt;String&gt;<br>}<br><br>// 2. Create the extension<br>val cleanupConfig = extensions.create&lt;CleanupConfig&gt;(&quot;cleanupConfig&quot;).apply {<br>    normalFolder.convention(&quot;temp&quot;)<br>}<br>val anotherCleanUpConfig = extensions.create&lt;AnotherCleanupConfig&gt;(&quot;anotherCleanupConfig&quot;).apply {<br>    normalFolder.convention(&quot;another-temp&quot;)<br>}<br><br>// 3. Register the tasks<br>tasks.register&lt;Delete&gt;(&quot;cleanTemp&quot;) {<br>    group = &quot;cleanup&quot;<br>    description = &quot;Deletes the primary temp folder&quot;<br><br>    // We use the provider to ensure we get the latest value<br>    delete(layout.projectDirectory.dir(cleanupConfig.normalFolder))<br>}<br><br>tasks.register&lt;Delete&gt;(&quot;cleanAnotherTemp&quot;) {<br>    group = &quot;cleanup&quot;<br>    description = &quot;Deletes the secondary temp folder&quot;<br><br>    delete(layout.projectDirectory.dir(anotherCleanUpConfig.normalFolder))<br>}<br><br>// 4. How to change values later in the script (optional)<br>cleanupConfig.normalFolder.set(&quot;youtube&quot;)<br>anotherCleanUpConfig.normalFolder.set(&quot;another-youtube&quot;)</pre><p>Some example of pre-defined extentions are like <a href="https://docs.gradle.org/current/dsl/org.gradle.api.plugins.JavaPluginExtension.html">java’s</a> — sourceCompatibility, targetCompatibility, etc,..</p><h3>How do I read em?</h3><p>Where are they defined and how do we read em?</p><p>Where do we start?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*syzD83yv27LdQsqE" /><figcaption>Photo by <a href="https://unsplash.com/@iamromankraft?utm_source=medium&amp;utm_medium=referral">Roman Kraft</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We got to read the files in the same way how a gradle will read to run them.</p><p>Bring into your memory the structure we saw earlier, where we got <strong><em>settings.gradle</em></strong> file, that’s where we start.</p><h4>The lifecycle phases</h4><p>Similar to how we read and infer a gradle project, gradle reads, compiles and execute them in three different phases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kGzmimyk30nQNIHrUV2GtA.png" /><figcaption><a href="https://docs.gradle.org/current/userguide/build_lifecycle.html#build_phases">Lifecycle phases</a></figcaption></figure><h4>- Initialization phase</h4><p>Both us and gradle needs to know what are all the sub projects available and what are all the plugins and where these plugins are found isn’t?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nOyUSijRJLE9AOT9" /><figcaption>Photo by <a href="https://unsplash.com/@hdbernd?utm_source=medium&amp;utm_medium=referral">Bernd 📷 Dittrich</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>That’s where,</p><ul><li><strong><em>include</em></strong> is used that represents the sub-project</li><li><strong><em>plugins</em></strong> that’s needed</li><li><strong><em>pluginManagement </em></strong>to help us know where these plugins are pulled from. For example mavenCentral, mavelLocal or a custom artifactory.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mNqVQifobykWwV2BBauBUw.png" /></figure><blockquote><strong>Side note: </strong><em>thats the reason why plugins or any piece of code cannot go before plug-in management because it needs to know where to get those plugins from.</em></blockquote><h4>- Configuration phase</h4><p>Now moving on into the <em>build.gradle</em> file in the root folder or in any of the other sub projects folder, we will find the following,</p><ul><li><strong><em>plugins</em></strong> — more plugins</li><li><strong><em>extra and extensions</em></strong> to pass in variable to these tasks</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I8mtnWb_SPcjT8sk" /><figcaption>Photo by <a href="https://unsplash.com/@hamburgmeinefreundin?utm_source=medium&amp;utm_medium=referral">Wolfgang Weiser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Now based on the list of tasks within these plugins it forms a DAG of tasks to execute them in order.</p><ul><li><strong><em>dependencies</em></strong> notes down all the list of dependencies</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U3sKgwNRhkCKV6SarxW7YQ.png" /><figcaption>Trying to download the resource — ./gradlew build — info</figcaption></figure><p>It resoles them, downloads and stores them into the cache.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VO16Qa0NWMGi4zIiJpZeAw.png" /></figure><blockquote><strong>Side note: </strong><em>This download is due since they might need to resolve the dependencies for Configuration cache— or else ideally the download would happen in the execution phase.</em></blockquote><h4>- Execution phase</h4><p>In the execution phases, when a command is issued, injects the extras and extensions into the tasks and runs them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1U9BpDIQ50Zzy8GL" /><figcaption>Photo by <a href="https://unsplash.com/@borderpolarphotographer?utm_source=medium&amp;utm_medium=referral">Anastasios Antoniadis</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>What else do I want to know?</blockquote><h3>Task Action</h3><p>They do not define the order of execution as in like <a href="#238f">dependency mechanisms</a>. However, we can execute something before or after a particular event occurs.</p><p>For eg, say if you want to print an success/error message after the <strong><em>temp folder </em></strong>is deleted, then if you just do,</p><pre>tasks.register(&quot;cleanTemp&quot;) {<br>    val tempDir = layout.projectDirectory.dir(&quot;temp&quot;).asFile<br>    <br>    // WITHOUT doLast:<br>    // This runs NOW (during Configuration), before any deleting happens.<br>    if (tempDir.exists()) {<br>        println(&quot;SUCCESS&quot;) <br>    }<br>}</pre><p>it would print <strong>SUCCESS</strong> even before it has executed it since it does that during configuration phase.</p><p>But when you use a <strong>task action </strong>like <strong><em>doLast</em></strong>,</p><pre>tasks.register&lt;Delete&gt;(&quot;cleanTemp&quot;) {<br>    group = &quot;cleanup&quot;<br>    description = &quot;Deletes the temp folder and prints a status message&quot;<br>    <br>    delete(layout.projectDirectory.dir(&quot;temp&quot;))<br>    <br>    // It runs ONLY after the internal &#39;Delete&#39; action finishes.<br>    doLast {<br>        val tempDir = layout.projectDirectory.dir(&quot;temp&quot;).asFile<br>        if (!tempDir.exists()) {<br>            println(&quot;SUCCESS: &#39;temp&#39; folder deleted.&quot;)<br>        } else {<br>            println(&quot;ERROR: &#39;temp&#39; folder still exists.&quot;)<br>        }<br>    }<br>}</pre><h3>Cache Management</h3><p>Gradle has a sort of unique caching mechanism, like your refrigerator where you don’t have to hop back and froth between the grocery store and home and have it cached in the fridge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1d47cq3Qah8ATvlk" /><figcaption>Photo by <a href="https://unsplash.com/@elloproducts?utm_source=medium&amp;utm_medium=referral">Ello</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It uses three different types like cold storage and freezer for different purpose.</p><h4>Build cache</h4><p>Gradle computes a unique <strong>Build Cache Key</strong> for each cacheable task by hashing its inputs (source files, classpath, task implementation, and properties). If the matching key exists then it uses the existing build results or else it run the task and caches them for the next build.</p><p>It can use either,</p><ul><li>Local cache — ~/.gradle/caches/build-cache-1</li><li>Remote cache — allows a team or CI to cache via HTTP backend(like <a href="https://gradle.com/develocity/product/build-cache/">Develocity</a>)</li></ul><h4>Dependency cache</h4><p>This manages the dependency jars to prevent repeated download.</p><ul><li>Artifacts are stored under ~/.gradle/caches/modules-2 and organized by checksum to handle multiple versions.</li><li>Metadata cache stores records how dynamic versions (e.g., 1.+) were resolved to concrete versions to speed up future checks</li></ul><h4>Configuration cache</h4><p>In the version 9.0+, it records the DAG and configurations, if on the subsequent run, if the script or env variables doesn’t change it skips Configuration phase and end up on the execution phase directly.</p><h3>Who runs the show?</h3><p>Gradle daemon is a long running process that start when we run,</p><pre>./gradlew ...</pre><p>and it keeps track of libs and load it quickly reducing the jvm overhead during build or else it might take a little for the jvm to load the classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*94yVxRGVJsJ_y2Hh" /><figcaption>Photo by <a href="https://unsplash.com/@ibrahimboran?utm_source=medium&amp;utm_medium=referral">Ibrahim Boran</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It keeps project metadata — structure, tasks, hashes hot in RAM so it allows to use it without recalculating it.</p><pre>// gradle.properties<br>org.gradle.daemon=true</pre><p>The above will keep the daemon live very useful in local during development and some CI environments sometimes disable the daemon for isolation, but many modern pipelines enable it for faster builds.</p><h3>Tracking dependencies</h3><p>Say for example if you want to find where the transitive dependency is coming from and if you are using an IDE like Itellij IDEA then, <strong><em>analyze dependency </em></strong>is really handy. Where you can sort things based on configuration aka scope and search for the dependency and find where it is coming from?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z6assdcFNf_eo4cH" /><figcaption>Photo by <a href="https://unsplash.com/@cj580?utm_source=medium&amp;utm_medium=referral">Chris Johnson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Alternatively you can use the following command,</p><pre>./gradlew :&lt;moduleName&gt;:dependencies</pre><p>or the following in case if you want more info about that particualar dependency for eg. jackson-databind, to figure out what is brining it in specifically,</p><pre>./gradlew dependencyInsight --dependency jackson-databind --configuration runtimeClasspath</pre><h4>Version catalog</h4><p>Say if we use multi-project builds, and if we got lot of sub-project and <strong><em>build.gradle</em></strong> file, we might end up using the same artifact in two different sub-projects — this version catalog solve this confusion by having a single file where the versions and artifact module are defined and could be just referenced in the respective sub-project’s <strong><em>build.gradle</em></strong> file reducing redundancy and single source of truth for dependencies making it easier to maintain and upgrade.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hmivVX4dgC-0aKnx" /><figcaption>Photo by <a href="https://unsplash.com/@minimdesignco?utm_source=medium&amp;utm_medium=referral">Brad</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This is how a <a href="https://docs.gradle.org/current/userguide/version_catalogs.html#sec:version-catalog-declaration">sample toml catalog</a>, would look like</p><pre>[versions]<br>springBoot = { strictly = &quot;3.3.2&quot; }<br>springCloud = &quot;2023.0.1&quot;<br><br>[libraries]<br># BOMs<br>spring-boot-bom = { group = &quot;org.springframework.boot&quot;, name = &quot;spring-boot-dependencies&quot;, version.ref = &quot;springBoot&quot; }<br>spring-cloud-bom = { group = &quot;org.springframework.cloud&quot;, name = &quot;spring-cloud-dependencies&quot;, version.ref = &quot;springCloud&quot; }<br><br># Web Starters<br>spring-boot-starter-web = { group = &quot;org.springframework.boot&quot;, name = &quot;spring-boot-starter-web&quot; }<br>spring-boot-starter-validation = { group = &quot;org.springframework.boot&quot;, name = &quot;spring-boot-starter-validation&quot; }<br>spring-boot-starter-actuator = { group = &quot;org.springframework.boot&quot;, name = &quot;spring-boot-starter-actuator&quot; }<br><br># Test Starters<br>spring-boot-starter-test = { group = &quot;org.springframework.boot&quot;, name = &quot;spring-boot-starter-test&quot; }<br><br># Cloud Starters<br>spring-cloud-starter-config = { group = &quot;org.springframework.cloud&quot;, name = &quot;spring-cloud-starter-config&quot; }<br>spring-cloud-starter-netflix-eureka-client = { group = &quot;org.springframework.cloud&quot;, name = &quot;spring-cloud-starter-netflix-eureka-client&quot; }<br>spring-cloud-starter-openfeign = { group = &quot;org.springframework.cloud&quot;, name = &quot;spring-cloud-starter-openfeign&quot; }<br><br>[bundles]<br># Separate Web Bundle<br>web-core = [&quot;spring-boot-starter-web&quot;, &quot;spring-boot-starter-validation&quot;, &quot;spring-boot-starter-actuator&quot;]<br><br># Separate Cloud Bundle<br>cloud-essentials = [&quot;spring-cloud-starter-config&quot;, &quot;spring-cloud-starter-netflix-eureka-client&quot;, &quot;spring-cloud-starter-openfeign&quot;]<br><br>[plugins]<br>spring-boot = { id = &quot;org.springframework.boot&quot;, version.ref = &quot;springBoot&quot; }<br>spring-dependency-management = { id = &quot;io.spring.dependency-management&quot;, version = &quot;1.1.4&quot; }</pre><p>If you closely look this resembles like a hashtable — like with a bucket of key value map. Here each bucket is defined like <strong>version, plugin, libs, bundles.</strong></p><p>This is how it would be referenced in the project’s <strong><em>build.gradle.kts</em></strong>,</p><pre>plugins {<br>    // Standard Java plugin<br>    java<br>    // Spring Boot and Dependency Management from your TOML<br>    alias(libs.plugins.spring.boot)<br>    alias(libs.plugins.spring.dependency.management)<br>}<br><br>dependencies {<br>    // Always import BOMs first to ensure version alignment<br>    implementation(platform(libs.spring.boot.bom))<br>    implementation(platform(libs.spring-cloud-bom))<br><br>    // Apply the Web bundle (standard for any REST API)<br>    implementation(libs.bundles.web.core)<br><br>    // Apply the Cloud bundle only if this is a Microservice<br>    implementation(libs.bundles.cloud.essentials)<br>    <br>    // Applying directly from the libs<br>    testImplementation(libs.spring.boot.starter.test)<br>}</pre><p>Here notice that, we are just referencing them either by <strong>libs </strong>or <strong>bundle </strong>and all the versions and the bundle’s dependencies are grouped in the <strong>toml </strong>file, this way if we are using in a multi-project build with multiple build.gradle.kts — it makes it easier to maintain and revise the version across the board.</p><p>If you are looking to migrate — feel free to check <a href="https://docs.openrewrite.org/recipes/gradle/migratedependenciestoversioncatalog">openwrite migrate to version catalog</a>.</p><h3>Enforcing standards</h3><h4>Convention plugin</h4><p>Say you got a team(s) of developers and apps, and you want to run pmd or sonar or you want to specify the common repositories where your team(s) pull artifacts from. That’s when you would use convention plugins — which is how you segregate the common tasks to be included directly like in a plugin instead of each application having their own.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rHjV1BKuE0EDiR1t" /><figcaption>Photo by <a href="https://unsplash.com/@camjames?utm_source=medium&amp;utm_medium=referral">Cam James</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You would need to use the built in plugins to build your custom convention plugin such as,</p><ul><li>For Kotlin DSL use <strong>kotlin-dsl</strong></li><li>For Groovy use<strong>groovy-gradle-plugin</strong></li></ul><p>For eg in case of <strong>Kotlin</strong>,</p><pre>// build-logic/build.gradle.kts<br>plugins {<br>    `kotlin-dsl`<br>}<br><br>repositories {<br>    mavenCentral()<br>    mavenLocal()<br>}</pre><p>where,</p><pre>// settings.gradle.kts (Root)<br>pluginManagement {<br>    includeBuild(&quot;build-logic&quot;) // Tells Gradle: &quot;Look here for plugins&quot;<br>}</pre><p>here —<strong><em> build-logic</em></strong> would be the folder in the root directory where all the conventions reside,</p><pre>// build-logic/src/main/kotlin/java-pmd-conventions.gradle.kts<br>plugins {<br>    id(&quot;pmd&quot;)<br>}<br><br>pmd {<br>    // Specify the version of PMD to use<br>    toolVersion = &quot;7.10.0&quot; <br>    <br>    // Whether to fail the build if errors are found<br>    isIgnoreFailures = false <br>    <br>    // Show errors in the console during the build<br>    isConsoleOutput = true <br>    <br>    // Minimum priority to report (1 is highest, 5 is lowest)<br>    rulesMinimumPriority = 5 <br><br>    // Point to your custom ruleset file (relative to project root)<br>    ruleSetFiles = files(rootProject.file(&quot;config/pmd/ruleset.xml&quot;))<br>    <br>    // Clear default rulesets if you are using a custom ruleSetFiles<br>    ruleSets = listOf() <br>}<br><br>// Optional: Ensure PMD runs as part of the &#39;check&#39; lifecycle<br>tasks.named(&quot;check&quot;) {<br>    dependsOn(tasks.withType&lt;Pmd&gt;())<br>}</pre><p>The above is what would your custom plugin library would look like and from the consuming application, you would just use,</p><pre>// app/build.gradle.kts (or any java sub-project/or consuming application)<br>plugins {<br>    id(&quot;java-pmd-conventions&quot;)<br>}</pre><p>And all the <strong><em>pmd</em></strong> tasks would then be applied to your sub-project or consuming project.</p><p>You could for a similar thing for sonar, spotless or your own custom tasks that you want to club and cascade it to your team(s).</p><h3>Maven vs Gradle</h3><h4>Use of wrapper</h4><p>Both maven and gradle support the use of wrapper instead of using a standalone executable making it easier to ship and build in different enviroments and machine without any version conflict hazzle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x6mhlNWnNjskgTpn" /><figcaption>Photo by <a href="https://unsplash.com/@minimdesignco?utm_source=medium&amp;utm_medium=referral">Brad</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>More descriptive vs being volatile</h4><p>In case of maven, since its going to be on the side of pom everthing is kinda structured as they base around xml. However, in case of gradle thats not the case. We can do what ever we want in a task making it sometime more tedious job to find why things are happening this way which is not the case in maven.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3RsZ8kCozaU0brm4" /><figcaption>Photo by <a href="https://unsplash.com/@bdchu614?utm_source=medium&amp;utm_medium=referral">Brendan Church</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Resolving issues</h4><p>Ideally both are somewhat identical in this case where i personally feel is maven is little bit easier since there are some useful plugins in idea such as maven helper to sort it out. When it comes to gradle — if there is any error in the build script you would be out of luck since it needs to run thru the lifecycle phases to sort things our which is kinda not the case in maven.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*w9kRnZ9qAyuNQBIc" /><figcaption>Photo by <a href="https://unsplash.com/@kowalikus?utm_source=medium&amp;utm_medium=referral">Krzysztof Kowalik</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Inheriting common standards</h4><p>In case of Maven we would use Parent pom and definde the plugins that needs to be executed on the downstream application where they are inherited, where the concept of parent does not exists in gradle and the same is acheived thru convention plugins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rQ7B-o2A6NwDXRrB" /><figcaption>Photo by <a href="https://unsplash.com/@jos_holland111?utm_source=medium&amp;utm_medium=referral">Joe Holland</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Artifact convention</h4><p>This would be different when you take a look at how a dependency artifact is being referenced.</p><p>In case of Maven, the artifact is represented in <strong><em>group, artifact</em></strong> and <strong><em>version.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pz23X-hr6-OCC0sgGxqTtA.png" /></figure><p>However in Gradle, the <strong>group</strong> and <strong>artifact</strong> are combined as in <strong><em>module (group:artifact) </em></strong>along with the <strong><em>version.</em></strong></p><p>End of the day, gradle uese maven formatted repositories to download dependencies. However for the plugins specifically they got <a href="https://plugins.gradle.org/">Gradle plugin portal</a>.</p><h4>Which is faster?</h4><p>This would be the final deciding factor in most teams as they don’t want to spend a lot of time to wait for the build to take their whole time just for a line of code change. Thats where gradle sophisticated caching mechanism takes over maven’s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LnwBfJfoWgpvX1Zp" /><figcaption>Photo by <a href="https://unsplash.com/@harleydavidson?utm_source=medium&amp;utm_medium=referral">Harley-Davidson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Closing thoughts</h3><p>I hope, I did not waste your time brining in stuff from AI rather I wanted to narrate thats something I felt would be meaningful rather than talking about the syntax as I believe syntax is something that we could copy paste or get it from AI, but we would need to know the fundamentals and why we are doing it that way.</p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d56b88b274e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/gradle-101-behind-the-scene-4d56b88b274e">Gradle 101: Behind the scene</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring AI MCP Client & Server with Ollama for your enterprise application with SSE]]></title>
            <link>https://medium.com/javarevisited/spring-ai-mcp-client-server-with-ollama-for-your-enterprise-application-with-sse-73486cc5341c?source=rss-89fe0cf04a67------2</link>
            <guid isPermaLink="false">https://medium.com/p/73486cc5341c</guid>
            <category><![CDATA[spring-ai]]></category>
            <category><![CDATA[mcp-client]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[ai-chatbot]]></category>
            <dc:creator><![CDATA[Suriya]]></dc:creator>
            <pubDate>Sun, 22 Jun 2025 15:44:10 GMT</pubDate>
            <atom:updated>2025-06-24T01:49:28.621Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Spring AI Chatbot with MCP Client - Server &amp; Ollama</h3><h4>Localhost-ing end to end with your enterprise application</h4><h3>What is this article about?</h3><p>Is Java keeping up with the AI race?. Since it has already lost a certain aspect of training AI models, this time <a href="https://spring.io/projects/spring-ai">Spring team</a> has done a quite good job abstracting lot of stuff to bring in AI into the existing enterprise application without switching the stack to python or typescript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r3XHROvQWNtrrVeg" /><figcaption>Photo by <a href="https://unsplash.com/@capstoneeventgroup?utm_source=medium&amp;utm_medium=referral">Capstone Events</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This article discuss about how you can bring in AI chat for your users so that they can interact with your production application or at the bare minimum could be a better assistants than the most pre configured assistants available in the market today.</p><h3>Index</h3><ul><li><a href="#869d">Assumptions</a></li><li><a href="#ddbd">Install Ollama</a></li><li><a href="#d73b">Spring Client with Generic AI chatbot</a></li><li><a href="#1e51">Spring MCP Server and tools</a></li><li><a href="#02af">Spring MCP Client with tools callback</a></li><li><a href="#c45e">What’s next for you to explore</a></li></ul><h3>Assumptions</h3><p>This article assumes that you at least have some basic understanding of what an <a href="https://en.wikipedia.org/wiki/Large_language_model">LLM</a>, <a href="https://en.wikipedia.org/wiki/Inference_engine">Inference Engine</a>, <a href="https://modelcontextprotocol.io/introduction">MCP</a>, <a href="https://cloud.google.com/discover/what-are-ai-agents">AI agents</a>. If not refer this video,</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DchBd2Ls_4_Y&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FchBd2Ls_4_Y" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9bacec9d6f028b7c75341d93cc4a1328/href">https://medium.com/media/9bacec9d6f028b7c75341d93cc4a1328/href</a></iframe><blockquote><strong>Note</strong> I will keep this article lean and thin with the default props and configuration to make it easier to understand.</blockquote><h3>Installing Ollama</h3><h4>Why?</h4><p>Unlike <a href="https://platform.openai.com/api-keys">Open API</a> or <a href="https://claude.ai/new">Claude</a>, I was looking for something that is open source with MIT license that I could run internally. It is an <a href="https://en.wikipedia.org/wiki/Inference_engine">inference engine</a> so, we can <a href="https://ollama.com/search">switch between models</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gajeUpdTtvIJ5E8A" /><figcaption>Photo by <a href="https://unsplash.com/@emilianovittoriosi?utm_source=medium&amp;utm_medium=referral">Emiliano Vittoriosi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Alternatively, you can use the one that best suites your choice. If you are looking for sandboxing there is a easy <a href="https://medium.suriyaprakhash.com/llms-with-your-internal-data-c88999aa9b49">docker model runner</a> way — but it is not good enough yet.</p><h4>Steps</h4><ul><li>Download and install <a href="https://ollama.com/">Ollama</a> based on your OS.</li><li>Run the setup, once installed. You should be able to run in the command line, which will also expose the <strong>ollama service</strong> on <em>127.0.0.1:</em><strong><em>11434</em></strong></li></ul><pre>&gt; ollama</pre><ul><li>At this point, you don’t have any models installed and when you <strong>list, </strong>you might not find anything.</li></ul><pre>&gt; ollama list</pre><ul><li>So you would need to install an LLM with tools of your choice, eg. llama3.2</li><li>Run the model to test,</li></ul><pre>&gt; ollama run llama3.2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*7tj-zR93Qb8z0U294tpsrQ.png" /></figure><h3>Spring Client with AI Chatbot</h3><h4>Generic chatbot</h4><p><a href="https://docs.spring.io/spring-ai/reference/api/chatclient.html">Spring AI</a> has made this stupid simple to run with java application,</p><p>just add to the pom,</p><pre>  &lt;dependency&gt;<br>   &lt;groupId&gt;org.springframework.ai&lt;/groupId&gt;<br>   &lt;artifactId&gt;spring-ai-starter-model-ollama&lt;/artifactId&gt;<br>  &lt;/dependency&gt;</pre><p>and the AI bill of materials</p><pre> &lt;dependencyManagement&gt;<br>  &lt;dependencies&gt;<br>   &lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.ai&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-ai-bom&lt;/artifactId&gt;<br>    &lt;version&gt;${spring-ai.version}&lt;/version&gt;<br>    &lt;type&gt;pom&lt;/type&gt;<br>    &lt;scope&gt;import&lt;/scope&gt;<br>   &lt;/dependency&gt;<br>  &lt;/dependencies&gt;<br> &lt;/dependencyManagement&gt;</pre><p>The above will autoconfigure and connect to the Ollama server on the default port.</p><p>Now that you have added them into your <em>application.properties</em>, point which model you would like to use.</p><pre>spring.ai.ollama.chat.options.model=llama3.2</pre><p>And the one final thing, to add a controller to expose the chat client,</p><pre>@RequestMapping(&quot;ai-chat&quot;)<br>@RestController<br>public class AIChatController {<br><br>    private final ChatClient chatClient;<br><br>    public AIChatController(ChatClient.Builder chatClientBuilder) {<br>        this.chatClient = chatClientBuilder.build();<br>    }<br><br>    @PostMapping<br>    public String chat(@RequestBody String message) {<br>        return chatClient.prompt(message).call().content();<br>    }<br><br>}</pre><p>here,</p><p><strong><em>ChatClient </em></strong>— gets auto wired automatically since we have the Ollama AI Chat dependency.</p><p><strong><em>ChatBuilder </em></strong>— is were you can wire few configuration such as chat history repository as such — for now we will keep it simple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6wcmzHEaMG81hTcLu0kcyg.png" /></figure><h3>Spring MCP Server and tools</h3><h4>Why?</h4><p>Now, if you notice the above chat bot does not have any info about your production application isn’t. How can we tell this LLM the context about our application so that it can use the data from it to answer questions relevant to your application. That’s where MCP comes into picture.</p><p>As per the MCP standard it exposes tools, resources, completions, etc. which the LLM clients can use to provide context to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1HF-Us8tHra8wm6i" /><figcaption>Photo by <a href="https://unsplash.com/@gcalebjones?utm_source=medium&amp;utm_medium=referral">Caleb Jones</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Ideally you will be already running your production applications on a URL which you can connect with this MCP server via SSE.</p><blockquote><strong>Note </strong>we will not be using <strong>Stdio </strong>instead will be using <a href="https://modelcontextprotocol.io/docs/concepts/transports#server-sent-events-sse-deprecated">SSE (which is currently deprecated in favor of HTTP)</a> so that we can just rely on the REST endpoints.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*jM5Tlb3J4IQApwlBPKgrog.png" /></figure><h4>Steps</h4><p>First thing first we would need to add the following to our MCP server application along with the <strong>Spring AI bill of materials</strong> into your pom,</p><pre>  &lt;dependency&gt;<br>   &lt;groupId&gt;org.springframework.ai&lt;/groupId&gt;<br>   &lt;artifactId&gt;spring-ai-starter-mcp-server-webflux&lt;/artifactId&gt;<br>  &lt;/dependency&gt;</pre><p>And on the application side,</p><pre>@SpringBootApplication<br>public class McpServerApplication {<br><br> public static void main(String[] args) {<br>  SpringApplication.run(McpServerApplication.class, args);<br> }<br><br> @Bean<br> public List&lt;ToolCallback&gt; suriyaTools(ProductService productService) {<br>  return List.of(ToolCallbacks.from(productService));<br> }<br><br>}</pre><p>here,</p><p><strong><em>ToolCallback </em></strong>— refers to the tools where it can be executed by an AI model.</p><p><strong><em>ProductService </em>—</strong>contains the tools that this MCP server offers.</p><p>Now we need to configure tools,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zs93U4-lte0ZbX0EVENIhg.jpeg" /></figure><p>And on the <strong><em>ProductService</em></strong> side,</p><pre> @Tool(name = &quot;get_all_products&quot;,description = &quot;It returns the name, type and cost of all the available products&quot;)<br> public String getProducts() {<br>  List&lt;ProductsData&gt; productsDataList = restClient.get().uri(&quot;/api/products&quot;).retrieve().body(new ParameterizedTypeReference&lt;List&lt;ProductsData&gt;&gt;() {});<br>        assert productsDataList != null;<br>        return productsDataList<br>    .stream()<br>    .map(productsData -&gt; String.format(&quot;&quot;&quot;<br>     Name: %s<br>     Type: %s<br>     Price: %s<br>     &quot;&quot;&quot;, productsData.name(), productsData.type(), productsData.price()))<br>    .collect(Collectors.joining(&quot;\n&quot;));<br> }</pre><p>Just add a REST Client to grab the info of your production application.</p><pre>spring.ai.mcp.server.name=my-inventory-server<br>spring.ai.mcp.server.version=0.0.1<br>#spring.ai.mcp.server.type=ASYNC - This in case if you are usign for async callbacks</pre><h3>Spring MCP Client with tools callback</h3><p>Now that we have configured the required tools on the MCP server, we can provide the tool context to the LLM on the client side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zmNLs-ixu5UIB5gh" /><figcaption>Photo by <a href="https://unsplash.com/@jeriden94?utm_source=medium&amp;utm_medium=referral">Jeriden Villegas</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In <strong><em>application.properties, </em></strong>specify the address where the MCP server is running at,</p><pre>spring.ai.mcp.client.sse.connections.my-mcp-server.url=http://localhost:8081</pre><p>The following will wire all the tools defined in the MCP server into the <strong>McpSyncClient</strong>,</p><pre> @Bean<br> @Qualifier(&quot;my-mcp-server-callback-tool-provider&quot;)<br> public SyncMcpToolCallbackProvider toolCallbackProvider(List&lt;McpSyncClient&gt; mcpSyncClients) {<br>  return new SyncMcpToolCallbackProvider(mcpSyncClients);<br> }</pre><p>Now the controller changes to the following to provide the tool context to the LLM,</p><pre>@RequestMapping(&quot;mcp-chat&quot;)<br>@RestController<br>public class McpChatController {<br><br>    private final ChatClient chatClient;<br><br>    private final SyncMcpToolCallbackProvider syncMcpToolCallbackProvider;<br><br>    public McpChatController(ChatClient.Builder chatClientBuilder,<br>                             @Qualifier(&quot;my-mcp-server-callback-tool-provider&quot;) SyncMcpToolCallbackProvider syncMcpToolCallbackProvider) {<br>        this.chatClient = chatClientBuilder.build();<br>        this.syncMcpToolCallbackProvider = syncMcpToolCallbackProvider;<br>    }<br><br>    @PostMapping<br>    public String chat(@RequestBody String message) {<br>        return chatClient.prompt()<br>                .user(message)<br>                .toolCallbacks(syncMcpToolCallbackProvider)<br>                .call().content();<br>    }<br>}</pre><p>Now let’s test it calling the MCP chat client’s endpoint,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dqkwrPfpPPCOkQr384c4eg.png" /></figure><p>Well, now you have a basic end-to-end code ready for the MCP client — server using an inference engine wherein you could switch LLM models of your choice.</p><h3>What’s next for you to explore?</h3><p>Having a robust local AI chatbot integrated with enterprise tools is a significant achievement. Dive deeper into Spring AIs advanced features, such as prompt engineering, managing chat history, and implementing more sophisticated agentic behaviors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zQJ7dnn2zWE9d3T9" /><figcaption>Photo by <a href="https://unsplash.com/@07lista?utm_source=medium&amp;utm_medium=referral">Amy Lister</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This foundational knowledge empowers you to continually evolve your applications, making them smarter and more responsive to the dynamic needs of your users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73486cc5341c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/spring-ai-mcp-client-server-with-ollama-for-your-enterprise-application-with-sse-73486cc5341c">Spring AI MCP Client &amp; Server with Ollama for your enterprise application with SSE</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LLMs with your Internal Data]]></title>
            <link>https://levelup.gitconnected.com/llms-with-your-internal-data-c88999aa9b49?source=rss-89fe0cf04a67------2</link>
            <guid isPermaLink="false">https://medium.com/p/c88999aa9b49</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm-agent]]></category>
            <category><![CDATA[docker-desktop]]></category>
            <dc:creator><![CDATA[Suriya]]></dc:creator>
            <pubDate>Wed, 11 Jun 2025 15:04:54 GMT</pubDate>
            <atom:updated>2025-06-11T15:04:54.833Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Look at Docker’s New AI Tools</h4><p>Have you ever wished your AI models could understand and answer questions specific to your company’s internal data — whether it’s tucked away in a database, flowing through an analytics platform like Grafana, or tracked in a tool like Jira?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9HwjUoBIdMaKHACe" /><figcaption>Photo by <a href="https://unsplash.com/@yngprmtv?utm_source=medium&amp;utm_medium=referral">Filip Urban</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The good news is, we’re moving closer to making that a seamless reality, after the introduction of MCP protocol things started becoming easier where the LLMs act as specialized AI agents for your internal applications and user base.</p><h4>What are we trying to do?</h4><p>We will take a simple case example to use Postgres SQL as our internal system where inventories are stored and would use the LLMs to use the context from the SQL table and perform queries requested using a chat client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n39SJ0v12CJdcasI" /><figcaption>Photo by <a href="https://unsplash.com/@pickawood?utm_source=medium&amp;utm_medium=referral">Pickawood</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>For the above mentioned use case, we will be using the PostgreSQL DB running in docker to store the inventory table information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INDVE7gzuZNaMl8NpT9CFw.png" /></figure><p>Now we got that in place, say if someone who does not have knowledge about the SQL, can now use the chat bot to interact with it.</p><h4>Why MCP?</h4><p>But wait a min! Isn’t the Chat GPT or Google Gemini good enough? Well they are general purpose transformers, where they might not have context about your tables internal to your company.</p><p>So, the idea is to make these LLMs aware of these data or information.</p><p>This is where <strong>Model Context Protocol</strong> comes into the picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*0_Jsqp6mPvYx78fdoPuR8Q.png" /></figure><p>Here MCP server acts as the middle man interacting with your internal system.</p><p>To make things stupid simple, now in 4.40+ version of docker desktop, the beta MCP toolkit provides some out of the box easy solution to configure the tools.</p><h4>MCP Toolkit</h4><p>Why we need this? The MCP server is the MCP standard where we can use any LLM GPT tool that supports MCP to interact with it and link the required context <em>(the internal information)</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x8YDEOaCqUGNyJt4" /><figcaption>Photo by <a href="https://unsplash.com/@toddquackenbush?utm_source=medium&amp;utm_medium=referral">Todd Quackenbush</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This is where it might help some one who does not have working knowledge about the technology and they can have the MCP server configured out of the box from the available catalog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ySQLKpY8qFlGlTI6YBzdfw.png" /></figure><p>Here, <strong>tool </strong>could be in simple terms an API do a certain thing, say read the data, find the info on the internet, etc.</p><p>Add the <strong>PostgreSQL readonly </strong>— it has just got one tool at this point where we can <strong>query the records</strong>.</p><p>Provide the connection configuration URL in the config tab,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Az_Xl7J-9JuDJpv99NavIw.png" /></figure><pre>postgres://postgres:test@localhost:5432/postgres</pre><p>here,</p><ul><li>username — postgres</li><li>password — test</li><li>postgres db is running on port 5432 in my local</li><li>postgres <em>(after /)</em><strong> — </strong>is my database name</li></ul><p>Once MCP server is in place and is connected to the Postgres URL, then we can use any client to connect to it and just chat with it.</p><p>For this purpose, we have multiple GPTs available in the market today, however we would need an MIT licensed or a Apache licensed model to use it in the workplace. However there are other alternatives as well based on the place you work for.</p><h4>Model runner</h4><p>The model runner in the Docker desktop provides a direct access to the models without need to use a client to chat with. They got models that you can download and run it directly in the docker desktop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ulCYrJvbrgYA2wc-7LSm-Q.png" /></figure><p>However, at the time of this article, we do not have an option to use the custom tool to connect to this model.</p><h4>Gordon</h4><p>That’s where the docker desktop’s own AI chat bot Gordon comes into the picture. However one would need to enable this at this point from the settings,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*URXw3hSEJSGgTsiaPfkEJg.png" /></figure><p>Once enabled, connect Gordon to access the MCP servers in the docker desktop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yGxgwX8NKStb37HsFoor9g.png" /></figure><p>Now that we have connected our Gordon client to the MCP server with PostgreSQL tools, we need to restart the docker desktop to load the tools</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QwPVpS9aSLnNdqbMa_o1xA.png" /></figure><p>I am personally not impressed with its results, for example here is the find items from the inventory that are below 5 dollars,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hBmbijjisnrPYI0bdjGhNQ.png" /></figure><p>To be honest, this is still in the beta version and would hope to work better when it actually gets released.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_DOeLRBEetfQOgoP" /><figcaption>Photo by <a href="https://unsplash.com/@anthonytran?utm_source=medium&amp;utm_medium=referral">Anthony Tran</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Alternatively one can use the <strong>docker mcp gateway — </strong>if you are using your own chatbot client.</p><p>For this demonstration to make it fruitful, we shall use the Claude desktop.</p><h4>Claude desktop</h4><p>If you are not familiar with <a href="https://claude.ai/download">Claude</a>, its a chatbot similar to Chat GPT. It does answer the general questions using its own LLM model. But to give the context about your own database table, we will need to connect it to the MCP server similar to how we did with Gordon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*WhuH8bNgU0aTtP-kh706Cw.png" /></figure><p>In the Claude desktop, select file -&gt; settings -&gt; developers and click on <strong>edit config,</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*BBihHXEIS6jcWbJONFFQ9w.png" /></figure><p>that will open the <strong>claude_desktop_config.json </strong>location in your machine, now add the following,</p><pre>{<br>  &quot;mcpServers&quot;: {<br> &quot;inventory&quot;: {<br>      &quot;command&quot;: &quot;docker&quot;,<br>      &quot;args&quot;: [<br>        &quot;run&quot;,<br>        &quot;-i&quot;,<br>        &quot;--rm&quot;,<br>        &quot;mcp/postgres&quot;,<br>        &quot;postgresql://postgres:test@host.docker.internal:5432/postgres&quot;<br>      ]<br>    }<br>  }<br>}</pre><p>The above tells that you are going to use <strong>inventory mcp server </strong>which is running on the docker desktop.</p><p>Once the changes are saved, make sure to <strong>quit </strong>the claude desktop and restart it.</p><p>Now you will start seeing this <strong>inventory </strong>MCP server,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*eTxDeaujK3If-T4zEmIp3Q.png" /></figure><p>Now that your LLM has got the inventory context — it is now ready to server you with the queries from the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1PiUacqYh-O-cbs6eQI_rg.png" /></figure><p>The results that it provides are much better. But this article could be a very good starting point for some one who is trying to start with MCP servers and clients.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c88999aa9b49" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/llms-with-your-internal-data-c88999aa9b49">LLMs with your Internal Data</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Monitoring and Embracing Observability]]></title>
            <link>https://levelup.gitconnected.com/beyond-monitoring-and-embracing-observability-87182c7b919a?source=rss-89fe0cf04a67------2</link>
            <guid isPermaLink="false">https://medium.com/p/87182c7b919a</guid>
            <category><![CDATA[tracing]]></category>
            <category><![CDATA[metrics]]></category>
            <category><![CDATA[logs]]></category>
            <category><![CDATA[observability]]></category>
            <category><![CDATA[opentelemetry]]></category>
            <dc:creator><![CDATA[Suriya]]></dc:creator>
            <pubDate>Sun, 13 Apr 2025 11:37:45 GMT</pubDate>
            <atom:updated>2025-04-14T00:12:35.686Z</atom:updated>
            <content:encoded><![CDATA[<h4>A consolidated reference for Spring boot Devs</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SrYlKOdwdr9H5HQI" /><figcaption>Photo by <a href="https://unsplash.com/@freddymarschall?utm_source=medium&amp;utm_medium=referral">Frederick Marschall</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Contents</h3><ul><li><a href="#02b4">But why?</a></li><li><a href="#07a2">What is instrumentation?</a></li><li><a href="#41b6">Observability vs Monitoring</a></li><li><a href="#696d">Understanding the pieces</a><br>- <a href="#76b8">Logs</a><br>- <a href="#0156">Trace</a><br>- <a href="#9233">Metrics</a><br>- <a href="#7501">Profiling</a><br>- <a href="#2fb8">Alerts</a><br>- <a href="#9d58">Visualization and more</a></li><li><a href="#892f">How do we do it?</a><br>- <a href="#523d">Application instrumentation</a><br>- <a href="#1cff">Data backends</a><br>- <a href="#52bc">Visualization</a><br>- <a href="#9839">The broker</a></li><li><a href="#1ac2">What choice do we have for Spring Boot?</a><br>- <a href="#161a">Paid</a><br>- <a href="#544c">Open source</a></li><li><a href="#055e">Takeaway</a></li></ul><h3>Why this post?</h3><p>There are lot of moving pieces, standards and tools when it comes to this topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TykaBDRnjoM4HzNs" /><figcaption>Photo by <a href="https://unsplash.com/@alimor?utm_source=medium&amp;utm_medium=referral">Mor THIAM</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I wanted to make this article to explain those moving pieces from my individual perspective and how they interact with each other and provide a overall clear picture.</p><blockquote><strong>Sidenote — </strong>If you are already know how these pieces interact and would just looking for a step-by-step guide to start with your Spring boot app,</blockquote><blockquote>Check the following post,</blockquote><blockquote><a href="https://medium.com/javarevisited/step-by-step-spring-boot-observability-d915279fc2a9">https://medium.com/@suriyaprakhash/grafana-spring-boot-observability-d915279fc2a9</a></blockquote><p>If you are looking for the video version of this, check here</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FxR9q8xqwadI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DxR9q8xqwadI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FxR9q8xqwadI%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/df50899219302e7bfaf77149305386cd/href">https://medium.com/media/df50899219302e7bfaf77149305386cd/href</a></iframe><h3>Well, what the heck is instrumentation?</h3><p>If you are new to the world of observing an application say to figure out the root cause of an production issue, understand how your app performs, debug an issue faster, understand how much time it takes to run, how much memory it consumes, how one component affects the other, how do we know if we need to make any changes to make functionality work better, etc. then we would need to do something to our app such that they emit data points, which we can use to visualize, analyze and alert.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dyud_OTA-ruB_ncM" /><figcaption>Photo by <a href="https://unsplash.com/@torybgd?utm_source=medium&amp;utm_medium=referral">Tory Bishop</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This process of making either a code change or a config change to your application to understand the technical behavior is called observability instrumentation.</p><h3>What is Observability and how it differs from monitoring?</h3><p>In short,</p><ul><li>Monitoring tells you if there is a problem.</li><li>Observability helps you understand why there is a problem and how to fix it, even for issues you did not anticipate.</li></ul><h3>What do we need to know before we get started with it?</h3><p>Now that we know, what it is and what it could bring to the table, the first thing that comes to mind is the logs, isn’t?</p><p>The term “logs” in the context of computer systems and applications comes from the historical practice of keeping a <strong>chronological record of events</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vZGlLArGnMYBfqxV" /><figcaption>Photo by <a href="https://unsplash.com/@museumsvictoria?utm_source=medium&amp;utm_medium=referral">Museums Victoria</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Think of it like a <strong>ship’s logbook</strong> or a <strong>woodcutter’s log</strong> — a detailed account of what happened and when.</p><p>Well, that’s a good starting point.</p><p>Once you have the logs consoled out or written to a rolling file, now what — we would look for an easy way to search.</p><h4>Logs</h4><p>When we say search, if the logs are structured wouldn’t it be efficient to search, rather than searching on plain text log.</p><p>Yes it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L0nYCkzCWzfw1QEj" /><figcaption>Photo by <a href="https://unsplash.com/@beccatapert?utm_source=medium&amp;utm_medium=referral">Becca Tapert</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So we would need to find the search keys say <strong>the customer name or id, product id, user id, log level, time, tracking id, etc. </strong>So, when we have any issue say a customer says this isn’t working it’s easier to search the logs and timestamp.</p><h4>Tracing</h4><p>Now we have one of the tracking fields say <em>customerId</em> in an e-commerce app, the customer is only part of the order service however the order service talks to product service, inventory , notifying the shipping vendor service and others where <em>customerId</em> may be irrelevant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QCgyqZPcAncKuIK2" /><figcaption>Photo by <a href="https://unsplash.com/@polarmermaid?utm_source=medium&amp;utm_medium=referral">Anne Nygård</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Here, comes the <strong>traceId </strong>that tracks the movement of data points aka context propagation for the request across multiple services.</p><p>Along with it we also get a good picture of how long it takes for each of these services to finish its thing.</p><h4>Metrics</h4><p>Say when you run the service, you might need to know if there is any downtime, how much memory, CPU, threads, DB connection pool info, etc. your process is using.</p><p>Also at the same time you might need to know how many times a certain piece of method, functionality is being called or how much time it took. Say in the same e-commerce example say if you want to find how many times people just added items to the cart without proceeding to pay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MguHJL6D24tNtuW7" /><figcaption>Photo by <a href="https://unsplash.com/@mcverry?utm_source=medium&amp;utm_medium=referral">Mikail McVerry</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In general, you would at the least need to have the above three instrumented. Note that Logs, traces and metrics are the main 3 pillars of Observability.</p><h4>Profiling</h4><p>We all know that we are the best ever devs on the planet until we find something that someone points out that’s valid.</p><p>Would you consider it embarrassing or an opportunity to know about it?That’s where profiling comes into picture. Where it intends to embarrass you or impress you providing an opportunity to learn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9UVKEFTNM2vrRiUD" /><figcaption>Photo by <a href="https://unsplash.com/@nhoizey?utm_source=medium&amp;utm_medium=referral">Nicolas Hoizey</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Especially the Flame graph. Not to mention, thread info, call stack where you might end up finding unnoticed proxy methods calls and others.</p><h4>Alerting</h4><p>You cannot be in the system all the time or ask someone to monitor all the time. That’s where alerting comes into picture where you set a threshold on the activity that you are curious about and get a slack/teams notification or email notification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IIgv_0-78vneQQQz" /><figcaption>Photo by <a href="https://unsplash.com/@abiismail?utm_source=medium&amp;utm_medium=referral">abi ismail</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Visualizations, Monitoring &amp; the rest</h4><p>Service node dependency graph, AI Anomaly detection, root cause analysis, uptime heart beats — synthetic monitoring, real time user monitoring similar to <a href="https://developers.google.com/analytics">Google analytics</a>, SSL cert validity, dashboard are some of the others you might need to consider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*plTOwe5jFphnuZXZ" /><figcaption>Photo by <a href="https://unsplash.com/@lukechesser?utm_source=medium&amp;utm_medium=referral">Luke Chesser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>How do we do it?</h3><p>Either we do everything yourselves or follow the industry standards. To me, there is nothing right or wrong, it boils down to which is easy and effective for you and your application.</p><p>Well being said that, let’s jump into what the industry is suggesting.</p><p>To make this happen, we would need the following,</p><ul><li>Application instrumentation to push or make the data points available to be pulled by external systems.</li><li>Data backend where these data points are stored.</li><li>A tool to visualize the stored data points.</li></ul><p>The above is the same irrespective of whatever tech stack you are on.</p><h4>Application instrumentation — Spring boot</h4><p>Now let’s narrow that down to <a href="https://spring.io/blog/2022/10/12/observability-with-spring-boot-3">Spring boot</a> to dive into the details. To be honest, observability w.r.t Spring boot has not been consistent, however they are getting there.</p><blockquote>Micrometer</blockquote><p><a href="https://micrometer.io/">Micrometer</a> is the standard for <a href="https://spring.io/blog/2022/10/12/observability-with-spring-boot-3">spring boot</a>. It is abstract like Slf4j where logback is the default, if ppl want they can switch between logback or log4j2 with Slf4j.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H7F0qeYPPAgsyCcnAONIeg.png" /></figure><p>It provides libs and APIs for</p><ul><li>Preparing the data context on the application side</li><li>Converting the data to the right format such that the data backend could understand it</li></ul><h4>Data backends</h4><p>They either pull or get the data pushed from the application, so they are also referred to as <strong>Collectors</strong>.</p><p>They store the data either in the disk, blob store or in a table and manage the retention policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fkw1bFT4wYhenjK1XqbgSA.png" /></figure><p>Here are few standard tools,</p><ul><li><strong>logs</strong> — <a href="https://grafana.com/oss/loki/">grafana loki</a>, <a href="https://www.elastic.co/cloud/cloud-trial-overview?utm_campaign=Google-B-Amer-US&amp;utm_content=Brand-Core&amp;utm_source=google&amp;utm_medium=cpc&amp;device=c&amp;utm_term=elastic%20search&amp;utm_id=701610000005lJVAAY&amp;gad_source=1&amp;gclid=Cj0KCQjwqcO_BhDaARIsACz62vOiXiPdKQp3cuGeExwc-4iJUeYuwv2UYp-Y0sRiiZFaNzV5x1iZFRsaAgHHEALw_wcB">elastic search</a> (store the logs), <a href="https://www.elastic.co/logstash">logstash</a>(process the logs)</li><li><strong>traces</strong> — <a href="https://www.jaegertracing.io/">Jager</a> or <a href="https://zipkin.io/">zipkin</a> or <a href="https://grafana.com/oss/tempo/">grafana tempo</a></li><li><strong>metrics </strong>— <a href="https://prometheus.io/">Prometheus</a>, <a href="https://graphiteapp.org/">graphite</a>, <a href="https://victoriametrics.com/">victoriaMetrics</a></li><li><strong>profiling</strong>— <a href="https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/about.htm#JFRUH170">JFR</a>, <a href="https://glowroot.org/">Glowroot</a>, <a href="https://pyroscope.io/">Pyroscope</a></li></ul><h4>Visualization</h4><p>This is where we debug, analyze, configure and connect Data backends.</p><p>This is the place where we correlate info from different collectors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kBzCRCGNtH77gxIIA9IKRA.png" /></figure><ul><li><strong>total picture unified view</strong> — <a href="https://grafana.com/">grafana</a>, <a href="https://www.elastic.co/kibana">kibana</a>, <a href="https://www.dynatrace.com/?utm_source=google&amp;utm_medium=cpc&amp;utm_term=dynatrace&amp;utm_campaign=us-brand-brand&amp;utm_content=none&amp;utm_campaign_id=236796727&amp;gclsrc=aw.ds&amp;gad_source=1&amp;gclid=Cj0KCQjwqcO_BhDaARIsACz62vNWMxMM9hGoUQAyz-YfiwBPeR8BG5GsUK4YnUN5tulceST1mGE9UOoaAudqEALw_wcB">dynatrace</a></li><li><strong>dependency graph</strong> —<a href="https://github.com/NovatecConsulting/novatec-service-dependency-graph-panel/releases"> Novatec Service Dependency Graph</a></li><li><strong>alerting </strong>— <a href="https://grafana.com/docs/grafana/latest/alerting/">grafana alerts</a>, <a href="https://www.elastic.co/guide/en/kibana/current/alerting-getting-started.html">kibana alters</a></li></ul><h4>Broker — Man in the middle</h4><p>Well, I did not mention the broker before. Since the above three are the main moving parts here, we have lots of choices to switch around different tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5B8hBbC0UAFNz7Kt" /><figcaption>Photo by <a href="https://unsplash.com/@mike_cho?utm_source=medium&amp;utm_medium=referral">Mike Cho</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If we want to play around with different tools switching them often then we might need to update the config or change the code according to the format and the pattern the tool supports ending up with multiple combinations.</p><p>In order to avoid the combinatorial confusion, it would be better if we follow some standard that these tools adapt and understand, isn’t it? Like, how every motor driver knows how traffic light works and stops during red.</p><p>There comes a common standard called Otel aka OpenTelemetry.</p><blockquote>OpenTelemetry</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*dSwb55EUBt8-QpAXS2H9kQ.png" /></figure><p><a href="https://opentelemetry.io/">Otel</a> comes in many flavors they are the standards on how the data points should be structured and transmitted, they got library APIs to use to instrument an application, they got standalone services like Otel collectors, etc. So when someone mentions Otel, better ask them which aspect of Otel they are talking about.</p><h3>What choice do we have for Spring boot?</h3><p>It used to be just logs and jmx in the last decade that we used to use. Now, monitoring and observability by itself is huge giant to deal with which once instrument have actual benefits.</p><p>In the above mentioned tools there are several tools, that run on client machines, on SAAS, open sourced or behind the paid gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q5DVxpEQ9HIa0vCI" /><figcaption>Photo by <a href="https://unsplash.com/@claybanks?utm_source=medium&amp;utm_medium=referral">Clay Banks</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Most of them they overlap and provide extra functionality say Dynatrace, Elastic provides their own instrumentation lib and they also support otel standards. They also have their own metrics and stuff.</p><p>For production apps, to keep it simple, it boils down to,</p><h4>Paid</h4><p>If you can afford or if your company already has the infra acquired— checkout the paid version of <a href="https://aws.amazon.com/cloudwatch/">AWS CloudWatch</a>, <a href="https://azure.microsoft.com/en-us/products/monitor/?gad_source=1&amp;gclid=Cj0KCQjwqcO_BhDaARIsACz62vM63X2YxS8ji8NHcy5q0l3csHvZaBq3bCxiV69VKHDD0a2Wmn_gZuwaAjW9EALw_wcB#overview/?ef_id=_k_Cj0KCQjwqcO_BhDaARIsACz62vM63X2YxS8ji8NHcy5q0l3csHvZaBq3bCxiV69VKHDD0a2Wmn_gZuwaAjW9EALw_wcB_k_&amp;OCID=AIDcmm5edswduu_SEM__k_Cj0KCQjwqcO_BhDaARIsACz62vM63X2YxS8ji8NHcy5q0l3csHvZaBq3bCxiV69VKHDD0a2Wmn_gZuwaAjW9EALw_wcB_k_">Azure Monitor</a>, <a href="https://www.dynatrace.com/?utm_source=google&amp;utm_medium=cpc&amp;utm_term=dynatrace&amp;utm_campaign=us-brand-brand&amp;utm_content=none&amp;utm_campaign_id=236796727&amp;gclsrc=aw.ds&amp;gad_source=1&amp;gclid=Cj0KCQjwqcO_BhDaARIsACz62vNJlySZf5FCGUWIPgpcVxF1D2HqU1RzpAZQKWfNHaWTq7u-LQgN7GYaAq7uEALw_wcB">Dynatrace</a>, <a href="https://grafana.com/">Grafana</a> or <a href="https://www.elastic.co/">Elastic </a>— they have better support and you don’t have to worry about the upgrading different data backends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ubmd9P7jPlXkagXE4r0-TQ.png" /></figure><p>Mostly they come with operators in case of cloud or with a single agent which takes care of everything these days instead of having multiple shipping processes running parallel along with the application.</p><p>So it is easier to integrate, instrument and install, but needs the understanding of these monitoring system since they might have proprietary configurations. But they would also follow the OTEL data standards.</p><p>Also, these days they got AI anomaly detection, built-in alerting system, browser agent centric monitoring and tools.</p><p>If going with it opt for SAAS so you don’t have to worry about the upgrades, rather than paying for the license to be hosted on-prem.</p><h4>Open source</h4><p>Alternatively if you are looking for Open source version I would recommend with the following,<br>- Loki for logs connected to Grafana<br>- Zipkin(since I have been using it for Spring boot as a default with Sleuth, now part of micrometer)/Tempo for traces<br>- Prometheus for metrics<br>- Grafana for visualization</p><p>End of the day — they run as services and uses HTTP to transmit data and connect with each other. So, there will be a small cost involved for running the instances.</p><blockquote>Do I use the data backend directly?</blockquote><p>This would be straight forward and easy. In today’s world most of these data backend tools support otel standards and they seemless connect with Visualization tool like Grafana.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M8YMz9jYxRm7bNj5MGbc2Q.png" /><figcaption>eg. Grafana — Without OTEL collector — but you can use OTEL standard data format</figcaption></figure><blockquote>Do I go via Otel collectors?</blockquote><p>This would be an option if you need to change the data backend and experiment or even send the same data to multiple data backends say for eg. exporting the trace to Zipkin and Jager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MvHY4HlpZCaaDUDhX9wR8w.png" /><figcaption>eg. Grafana — With intermediate OTEL collector</figcaption></figure><p>Either way you will have to either do a,</p><ul><li>Manual instrumentation (needed for certain metrics when using spring boot micrometer)</li><li>Auto instrumentation (just a small config on the app end for tracing and logging)</li><li>Mange access for your users, maintain and host the data backends(Loki or Prometheus) and visualization tools (Grafana)</li></ul><p>If you are just experimenting in local,</p><ul><li>JFR — profiling (Intellij IDEA supports it out of the box)</li><li>Glowroot — for HTTP tracing</li><li>Running the open source data backends and grafana visualization as docker container</li></ul><p>End of the day, the total cost of ownership, including infrastructure, personnel time, and the value of the features and support offered by paid solutions are supposed to be consider while taking this decision.</p><h3>Takeaway</h3><p>Hopefully, this article has helped to clarify the often-fragmented world of Spring Boot observability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a_mvF4BGPt-iRCKN" /><figcaption>Photo by <a href="https://unsplash.com/@siora18?utm_source=medium&amp;utm_medium=referral">Siora Photography</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>My intention was to address the challenge of finding a consolidated resource that explains the various tools, standards, and their interactions. By bringing these pieces together, I hope to have provided a clearer overall picture for anyone looking to enhance their understanding and implementation of observability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87182c7b919a" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/beyond-monitoring-and-embracing-observability-87182c7b919a">Beyond Monitoring and Embracing Observability</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step by Step — Spring Boot Observability]]></title>
            <link>https://medium.com/javarevisited/step-by-step-spring-boot-observability-d915279fc2a9?source=rss-89fe0cf04a67------2</link>
            <guid isPermaLink="false">https://medium.com/p/d915279fc2a9</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[logs]]></category>
            <category><![CDATA[metrics]]></category>
            <category><![CDATA[traceability]]></category>
            <category><![CDATA[observability]]></category>
            <dc:creator><![CDATA[Suriya]]></dc:creator>
            <pubDate>Sun, 13 Apr 2025 07:03:56 GMT</pubDate>
            <atom:updated>2025-04-13T23:43:59.807Z</atom:updated>
            <content:encoded><![CDATA[<h3>Step by Step — Spring Boot Observability</h3><h4>localhost-ing</h4><p>This is a step-by-step guide to get started with the <a href="https://docs.spring.io/spring-boot/reference/actuator/observability.html">spring boot 3+ observability framework</a> in you local.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hJINBsr9GS4k8nzC" /><figcaption>Photo by <a href="https://unsplash.com/@tateisimikito?utm_source=medium&amp;utm_medium=referral">Jukan Tateisi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>To get the most out of this post, a basic understanding of the <a href="https://spring.io/projects/spring-boot">Spring boot framework</a> and experience with identifying and tracing issues in real-time applications will be helpful.</p><p>If you do not know what observability is or what monitoring is, what tools are involved, how they piece together then, I would recommend reading the big picture here first,</p><p><a href="https://medium.suriyaprakhash.com/beyond-monitoring-and-embracing-observability-87182c7b919a">Beyond Monitoring and Embracing Observability</a></p><p>before proceeding with this post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZxuBD8ml-QR5PWFY" /><figcaption>Photo by <a href="https://unsplash.com/@iamjoeroberts?utm_source=medium&amp;utm_medium=referral">Joe Roberts</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What are we trying to do here?</h3><p>We will only cover the 3 main pillars of observability and how to link between each other,</p><ul><li>Logs</li><li>Trace</li><li>Metrics</li></ul><p>This is what we are trying to do here,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*ne0Ij524sil5tG7HWRh05g.png" /></figure><p>Here is the corresponding youtube video for this article,</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcadFG9b6YjA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcadFG9b6YjA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcadFG9b6YjA%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/af2e87688208ceb96e8a551b0bea907d/href">https://medium.com/media/af2e87688208ceb96e8a551b0bea907d/href</a></iframe><h3>Setting up the env</h3><p>We will be using grafana for this</p><ul><li><a href="https://grafana.com/oss/loki/">Loki</a> as the <a href="https://medium.suriyaprakhash.com/87182c7b919a#76b8">log backend</a> (running on <a href="http://loki:3100/">http://loki:3100</a>)</li><li><a href="https://zipkin.io/">Zipkin</a> as the <a href="https://medium.suriyaprakhash.com/87182c7b919a#0156">trace backend</a> (running on <a href="http://loki:3100/">http://</a>zipkin:9411)</li><li><a href="https://prometheus.io/">Prometheus</a> as the <a href="https://medium.suriyaprakhash.com/87182c7b919a#9233">metrics backend</a> (running on <a href="http://loki:3100/">http://</a>prometheus:9090)</li></ul><p>Run the <a href="https://github.com/suriyaprakhash/docker-collection/blob/master/services/grafana/docker-compose.yml">docker-compose</a> to run them all along with the Grafana (running on <a href="http://loki:3100/">http://</a>localhost:3000)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QhmqZ6r1_WP1lTEd" /><figcaption>Photo by <a href="https://unsplash.com/@carrier_lost?utm_source=medium&amp;utm_medium=referral">Ian Taylor</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Steps to import data source</h4><ul><li><a href="http://localhost:3000/">Login local Grafana</a> using default — admin &amp; admin credentials.</li><li>From the menu add data source and select Loki</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*sP6_E0jZia9Bw-RuB_3jLA.png" /></figure><ul><li>Update the Loki URL and save.</li><li>Do the same for Zipkin and Prometheus</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1QNBuxV3f6BAFXXBVsBxoA.png" /><figcaption>Data sources listed</figcaption></figure><h3>Logging</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7z9BUUZymW9YjCqA" /><figcaption>Photo by <a href="https://unsplash.com/@glenncarstenspeters?utm_source=medium&amp;utm_medium=referral">Glenn Carstens-Peters</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Add logback — console appender for IDE logging,</p><pre>    &lt;appender name=&quot;CONSOLE&quot; class=&quot;ch.qos.logback.core.ConsoleAppender&quot;&gt;<br>        &lt;encoder&gt;<br>            &lt;pattern&gt;<br>                %d{yyyy-MM-dd HH:mm:ss} %highlight(%-5level) [%green(%thread),%X{traceId:-},%X{spanId:-},%X{userId}] %cyan(%logger{36}) - %msg%n<br>            &lt;/pattern&gt;<br>        &lt;/encoder&gt;<br>    &lt;/appender&gt;</pre><p>Here,</p><p>if you don’t see <strong>traceId</strong> or <strong>spanId</strong> or <strong>userId </strong>— we will get there shortly.</p><p>Now add the lib that helps with the <a href="https://logback.qos.ch/manual/appenders.html">logback appenders</a> and exports the logs to Loki backend.</p><pre>        &lt;!-- for loki logs --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.github.loki4j&lt;/groupId&gt;<br>            &lt;artifactId&gt;loki-logback-appender&lt;/artifactId&gt;<br>            &lt;version&gt;1.6.0&lt;/version&gt;<br>        &lt;/dependency&gt;</pre><p>Adding <a href="https://github.com/loki4j/loki-logback-appender">loki appender</a>,</p><pre>&lt;property name=&quot;serviceName&quot; value=&quot;server-app&quot; /&gt;<br>&lt;property name=&quot;app&quot; value=&quot;springboot-instrumentation&quot; /&gt;<br><br>&lt;appender name=&quot;LOKI&quot; class=&quot;com.github.loki4j.logback.Loki4jAppender&quot;&gt;<br>        &lt;http&gt;<br>            &lt;url&gt;http://localhost:3100/loki/api/v1/push&lt;/url&gt;<br>        &lt;/http&gt;<br>        &lt;format&gt;<br>            &lt;label&gt;<br>                &lt;pattern&gt;app=${app},service_name=${serviceName},host=${HOSTNAME},level=%level&lt;/pattern&gt;<br>                &lt;readMarkers&gt;true&lt;/readMarkers&gt;<br>            &lt;/label&gt;<br>            &lt;message&gt;<br>                &lt;pattern&gt;<br>                    {<br>                        &quot;level&quot;:&quot;%level&quot;,<br>                        &quot;class&quot;:&quot;%logger{36}&quot;,<br>                        &quot;thread&quot;:&quot;%thread&quot;,<br>                        &quot;message&quot;: &quot;%message&quot;,<br>                        &quot;traceId&quot;: &quot;%X{traceId:-}&quot;,<br>                        &quot;spanId&quot;: &quot;%X{spanId:-}&quot;<br>                    }<br>                &lt;/pattern&gt;<br>            &lt;/message&gt;<br>        &lt;/format&gt;<br>    &lt;/appender&gt;</pre><p>Now the <strong>loki-logback-appender </strong>should start shipping the logs to the loki server running on the docker instance</p><ul><li>http tag — where loki is running</li><li>label tag — specifies the optional baggage(extra key-value pair for searching)</li><li>pattern tag — specify the required keys in the json format</li></ul><p>Once you run the endpoint, you can see it in loki,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Shjhq37o0gPKQuYgvrJ0_Q.png" /></figure><p>here <strong>app </strong>in the label is nothing but the key from,</p><ul><li>label tag— in the appender and it corresponds to the key-app and the value-<em>springboot-instrumentation</em> in the <em>logback.xml</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*zsouMlzN03yJauMqjNzGgA.png" /></figure><h3>Tracing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3mQLbu2dK-W6Me5F" /><figcaption>Photo by <a href="https://unsplash.com/@martenbjork?utm_source=medium&amp;utm_medium=referral">Marten Bjork</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>For <a href="https://docs.spring.io/spring-boot/reference/actuator/tracing.html">tracing</a> you would need the following dependency,</p><pre>        &lt;!-- uses otel instrumentation (micrometer to otel) --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;io.micrometer&lt;/groupId&gt;<br>            &lt;artifactId&gt;micrometer-tracing-bridge-otel&lt;/artifactId&gt;<br>        &lt;/dependency&gt;<br>        &lt;!-- reporter to zipkin --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;io.opentelemetry&lt;/groupId&gt;<br>            &lt;artifactId&gt;opentelemetry-exporter-zipkin&lt;/artifactId&gt;<br>        &lt;/dependency&gt;</pre><ul><li><a href="https://docs.micrometer.io/tracing/reference/index.html">micrometer-tracing-bridge-otel</a> — to convert the format to otel such that the zipkin can understand — you can also brave if need be. But otel data format is better.<br>- This also brings in the <strong>traceId</strong> and <strong>spanID</strong></li><li><a href="https://opentelemetry.io/docs/specs/otel/trace/sdk_exporters/zipkin/">opentelemetry-exporter-zipkin</a> — this is what exports the traces to zipkin</li></ul><p>Configure the following in the <em>application.yml</em> or props — so that the lib knows where the <strong>zipkin</strong> is running,</p><pre># tracing<br>management.tracing.sampling.probability=1.0<br>management.zipkin.tracing.endpoint=http://localhost:9411/api/v2/spans<br>management.zipkin.tracing.export.enabled=true</pre><p>One important thing to note is that you would need to use <a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestClient.Builder.html">RestClient.Builder</a> and not just RestClient — this apply to <a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html">RestTemplate</a> and <a href="https://docs.spring.io/spring-framework/reference/web/webflux-webclient.html">WebClient</a> as well.</p><pre> private RestClient restClient;<br><br> public ClientApplication(RestClient.Builder restClientBuilder) {<br>  this.restClient = restClientBuilder.baseUrl(&quot;http://localhost:8081&quot;).build();<br> }</pre><p>Now once the rest call is made, you should start seeing this log,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wq5GKpU7iClwGx-YbmfmKg.png" /></figure><p>Here,</p><ul><li>The JSON string is the actual log</li><li>Fields are the key value baggage specified in the &lt;label&gt; tag of Loki logback appender</li><li>And finally to get the Links working, you would need to configure <a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html">Derived fields</a> in the Loki data source — regex <strong><em>“traceId”:\s*”([a-f0–9]{32})”</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yL3jc_1qcv70pe2nOROXKQ.png" /></figure><ul><li>That way now you can click on the link that takes you to the Zipkin</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iu381U8DynwHe8nKsiBXwg.png" /></figure><p>To <a href="https://grafana.com/docs/grafana/latest/datasources/zipkin/#trace-to-logs">link it back to the Loki</a> just update the following in <a href="https://grafana.com/docs/grafana/latest/datasources/zipkin/#zipkin-data-source">Zipkin data source</a>,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*rZB7holF1hdrGjkDSLn_-w.png" /></figure><p>here</p><ul><li>host — is my machine — you can update it to what yours is or to something else if you wish to</li><li>traceId — is what i want to link it back to — alternatively you can also link it back to the spanId if need be.</li></ul><p>Other than the traceId and spanId we can also send some useful info to be shown as field labels. Say for eg. userId in the first screenshot. Thats the baggage the trace context will carry along.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8BWMl6Gdh5bgNB87" /><figcaption>Photo by <a href="https://unsplash.com/@dkfra19?utm_source=medium&amp;utm_medium=referral">Dimitri Karastelev</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This helps to track the issue, when an user reports an issue — we could use the <strong>userId </strong>and the <strong>timestamp </strong>or alternatively even the exposed <em>requestId </em>or <em>traceId </em>that they see as part of the error message.</p><p>To add the <strong>userId</strong> baggage, I have the following AOP that would read the <strong>X-User-Id</strong> header from the incoming request and sets it to the span.</p><pre>@Around(&quot;@annotation(addBaggage)&quot;)<br>    public Object addBaggage(ProceedingJoinPoint joinPoint, AddBaggage addBaggage) throws Throwable {<br>        Object result = null;<br>        String userId = &quot;default-user&quot;;<br>        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();<br>        if (attributes != null) {<br>            HttpServletRequest request = attributes.getRequest();<br>            userId = request.getHeader(&quot;X-User-Id&quot;);<br>            log.debug(&quot;Intercepted method: {}&quot;, joinPoint.getSignature().toShortString());<br>            log.debug(&quot;X-User-Id: {}&quot;, userId);<br>        } else {<br>            log.warn(&quot;Not in a web request context, cannot access HTTP headers.&quot;);<br>        }<br><br>        Span span = tracer.currentSpan();<br>        assert span != null;<br>        try (BaggageInScope baggageInScope = tracer.createBaggageInScope(span.context(), &quot;userId&quot;, userId)) {<br>            // The baggage &quot;user-id&quot; with the extracted value is now in the current span context<br>            log.info(&quot;user-id {} added to the trace {}&quot;, tracer.getBaggage(&quot;userId&quot;), baggageInScope.name());<br>            result = joinPoint.proceed();<br>        }<br><br>        return result;<br>    }</pre><p>If you notice the above code,</p><ul><li>the actual controller method is surrounded by the this custom AOP</li><li>at this point of writing this, it only works with <strong>otel bridge</strong> and not the <strong>brave bridge</strong> — because of the baggage implementation</li><li>the corresponding controller method with the @AddBaggage custom annotation bounded into the <strong>Span Scope</strong>,</li></ul><pre> @AddBaggage<br> @GetMapping(&quot;/server/trace&quot;)<br> public String trace() {<br>  // Note here the MDC contains the userId value<br>  log.info(&quot;Logging on server - trace - with userId - {}&quot;, MDC.get(&quot;userId&quot;));<br>  return handlerService.helloWorld();<br> }</pre><ul><li>here MDC is the threadlocal</li></ul><p>This way you can search via userId like the following,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xap9L7UPta3iRd_NUOk64A.png" /></figure><h3>Metrics</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YXyrr5qmC13XRt-S" /><figcaption>Photo by <a href="https://unsplash.com/@marxgall?utm_source=medium&amp;utm_medium=referral">Marek Szturc</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Now we can see to add more <a href="https://docs.spring.io/spring-boot/reference/actuator/metrics.html">metric observabilty</a> info by adding the following dependency,</p><pre>        &lt;!-- this exposes the actuator metrics endpoint in prometheus format - so that prometheus could scrape --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;io.micrometer&lt;/groupId&gt;<br>            &lt;artifactId&gt;micrometer-registry-prometheus&lt;/artifactId&gt;<br>            &lt;scope&gt;runtime&lt;/scope&gt;<br>        &lt;/dependency&gt;</pre><p>The above will gather data for prometheus — however unlike loki or zipkin where you pushed the data from the application, for prometheus — you would do a <a href="https://prometheus.io/docs/prometheus/latest/getting_started/#configuring-prometheus-to-monitor-itself">scrape config</a>,</p><pre>global:<br>  scrape_interval: 10s<br>scrape_configs:<br>  - job_name: &#39;spring-boot-app&#39;<br>    metrics_path: &#39;/actuator/prometheus&#39;<br>    scrape_interval: 5s<br>    static_configs:<br>      - targets: [&#39;host.docker.internal:8080&#39;, &#39;host.docker.internal:8081&#39;] # Replace with your application&#39;s host and port</pre><p>here,</p><ul><li>the above is the config that goes in as part of the docker-compose.yaml</li><li>metrics path — prometheus does not understand the json form /actuator/metrics so the lib adds /actuator/prometheus so it understands the format</li><li>targets — specifies what services needs to be scraped for metrics</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dwpToxC8gHjErLUB" /><figcaption>Photo by <a href="https://unsplash.com/@ecasap?utm_source=medium&amp;utm_medium=referral">Elaine Casap</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Now you can navigate to the actuator endpoint to find the key would need the metric for and search,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mTzXgtJ2hOuKgo9B9x39lw.png" /></figure><h4>Custom metrics</h4><p>Now that you <a href="https://spring.io/blog/2022/10/12/observability-with-spring-boot-3">have connect the metrics endpoints</a>, wouldn’t it be nice to have our own, to do so we need to annotate with @Observed</p><pre> @GetMapping(&quot;/server/observe&quot;)<br> @Observed(name = &quot;observe.controller.method&quot;,<br>   contextualName = &quot;controller-observe-method&quot;)<br> public String observe(@RequestHeader(name = &quot;X-Tenant-Id&quot;) String tenantId) {<br>  // Note here the MDC contains the userId value<br>  log.info(&quot;Logging on server - observe - with userId - {}&quot;, MDC.get(&quot;userId&quot;));<br>  handlerService.observeServiceMethod();<br>  handlerService.observeFineControlServiceMethod(tenantId);<br>  return &quot;Hello World! Observe&quot;;<br> }</pre><p>here</p><ul><li>name — is the unique key under /actuator/metrics</li><li>contextualName — is a nice to have name that would show up in the trace instead of the default one</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gT0hWh7AGb3Pr8lG" /><figcaption>Photo by <a href="https://unsplash.com/@jasonthedesigner?utm_source=medium&amp;utm_medium=referral">Jason Richard</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>To add more weight to it, we can also use the observationRegistry to do the same as,</p><pre>    public void observeFineControlServiceMethod(String tenantId) {<br>        String data = Observation.createNotStarted(&quot;observe.service.fine-control-method&quot;, this.observationRegistry)<br>                .contextualName(&quot;service-observe-fine-ctrl-method&quot;)<br>                .lowCardinalityKeyValue(&quot;tenantId&quot;, tenantId)<br>                .highCardinalityKeyValue(&quot;user.id&quot;, MDC.get(&quot;userId&quot;))<br>                .observe(() -&gt; {<br>                    log.info(&quot;ObserveServiceMethod - fine controlled with userId - {}&quot;, MDC.get(&quot;userId&quot;));<br>                    return &quot;Processed: &quot; ;<br>                });<br>        log.info(&quot;ObserveServiceMethod(outside) - fine controlled with userId - {}&quot;, MDC.get(&quot;userId&quot;));<br>    }</pre><p>which will show up like,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*Vav4_7ZPFFGxxop4Dh-a1g.png" /></figure><p>Now to link the zipkin to prometheus, you might need to do the following in zipkin data source,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*AaQEe9KSHZeN9Jdf57piiQ.png" /></figure><p>here,</p><ul><li>Specified the tag as tenantId — since need to know how many request per tenantId for example</li><li>Count by tenant — counts the request by tenantId — observe_service_fine_control_method_seconds_count{$__tags}</li></ul><p>Also to add more to it you can also link things via <a href="https://grafana.com/docs/grafana/latest/fundamentals/exemplars/#introduction-to-exemplars">exemplers</a>.</p><p>For auto instrumentation, you can check <a href="https://grafana.com/oss/beyla-ebpf/">Grafana Beyla</a> similar to <a href="https://www.elastic.co/guide/en/fleet/current/fleet-overview.html">Fleet agent</a> or <a href="https://www.dynatrace.com/platform/oneagent/?utm_source=google&amp;utm_medium=cpc&amp;utm_term=dynatrace%20oneagent&amp;utm_campaign=us-brand-brand&amp;utm_content=none&amp;utm_campaign_id=236796727&amp;gclsrc=aw.ds&amp;gad_source=1&amp;gclid=Cj0KCQjw782_BhDjARIsABTv_JBaOlMUAYXlp-I3fg5vuEamR_AkZSqlBFys9sXydN-jgxFr_nd1u6EaAg6KEALw_wcB">One agent</a> from Elastic and Dyanatrace respectively.</p><p>And one last thing as part of this post,</p><p>Now given that we have done this, lets try with everything so we could even pass the baggage from the client instead of an custom annotation, we end up getting the following,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1GoSE1zprJFpSREzGTj2_w.png" /></figure><p>I have the code placed in my <a href="https://github.com/suriyaprakhash/springboot-instrumentation?tab=readme-ov-file#run">github repo</a> in case if you need to refer to.</p><h3><strong>Enhancing Your Observability Setup</strong></h3><p>This could be just an starting point, there is more you can do with it such as adding <strong><em>security</em></strong>, <strong><em>dashboards</em></strong>, sampling for high traffic apps, <strong><em>health checks</em></strong>, <strong><em>alerting</em></strong>, etc. By considering these, you can transform your initial local observability setup into a more powerful and insightful monitoring solution for your Spring Boot applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Xz1eZciKUlz7ciO-" /><figcaption>Photo by <a href="https://unsplash.com/@karsten116?utm_source=medium&amp;utm_medium=referral">Karsten Winegeart</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Again if you are looking for the overview video version, check here,</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FxR9q8xqwadI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DxR9q8xqwadI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FxR9q8xqwadI%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/df50899219302e7bfaf77149305386cd/href">https://medium.com/media/df50899219302e7bfaf77149305386cd/href</a></iframe><p>Happy localhost-ing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d915279fc2a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/step-by-step-spring-boot-observability-d915279fc2a9">Step by Step — Spring Boot Observability</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker WSL Integration]]></title>
            <link>https://levelup.gitconnected.com/docker-wsl-integration-d4ae61629da3?source=rss-89fe0cf04a67------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4ae61629da3</guid>
            <category><![CDATA[wsl-2]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[virtualization]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Suriya]]></dc:creator>
            <pubDate>Fri, 24 Jan 2025 01:57:25 GMT</pubDate>
            <atom:updated>2025-01-24T01:57:25.932Z</atom:updated>
            <content:encoded><![CDATA[<h3>Access docker from different WSL</h3><h3>WSL Integration, for windows users</h3><p>Say you got multiple WSL machines running in your windows host machine, and would like to build the docker image. Docker should either be installed in the WSL machine or could share it from the existing container.</p><h3>The problem</h3><p>Here you see, I got multiple WSL machine configured in my host windows machine,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2LZhKlk71zuhAMrtBjCe-Q.png" /></figure><p>My docker container is <strong>ubuntu-docker, </strong>that’s where I have the docker installed to run.</p><p>Once I start the docker desktop,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gApvyBSEKSsb18DJWSRkZg.png" /></figure><p>you can see that,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YRTN55ojB2xbZjgofX7hwQ.png" /></figure><p>If you don’t have multiple WSL and just docker desktop then you will see <strong>docker-default</strong> instead of <strong>ubuntu-docker.</strong></p><p>Being said that, if I wanted to run the docker on <strong>ubuntu-java </strong>WSL to build the image to run on the <strong>docker-default </strong>container, you could see that <strong>ubuntu-java</strong> does not have the docker installed,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TrX3n1ewB2Yz-DhPcT6mSg.png" /></figure><p>Now to build the docker image, or to run docker, either</p><ul><li>I would need to install a nested docker inside the WSL</li><li>Run the Dockerfile from the windows host machine accessing the wsl machine’s path</li><li>Enable WSL integration</li></ul><h3>The simplest solution</h3><p>Enable WSL integration is the simplest,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EcMi4dUQowwioHJ_vla3vQ.png" /></figure><p>This will mount the docker sock which you can verify in the non-docker machine by going to <strong><em>/var/run</em></strong> where you will find <strong>docker.sock, docker-desktop-proxy.pid</strong>, <strong>docker-cli.sock </strong>files.</p><p>Alternatively you can mount them here if you are not using docker desktop(the old way).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oSP6SZb1Crb_syoHaik49w.png" /></figure><p>After this you would see that you can run the <strong>docker </strong>cmd,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*V_sIwaZBJ2WfyBr7TXXiZA.png" /></figure><p>however when you try running the build,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VV2l4QRkwytyLgXYMlWLLA.png" /></figure><p>Check for the Linux file permission or just use sudo and you should be all set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQvl7eoKYqe9EF5eXgZPyg.png" /></figure><p>Happy localhost-ing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4ae61629da3" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/docker-wsl-integration-d4ae61629da3">Docker WSL Integration</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hosting custom sub-domains in AWS]]></title>
            <link>https://levelup.gitconnected.com/hosting-custom-sub-domains-in-aws-9e39cec83bd2?source=rss-89fe0cf04a67------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e39cec83bd2</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[website-development]]></category>
            <category><![CDATA[custom-domain]]></category>
            <category><![CDATA[website-traffic]]></category>
            <dc:creator><![CDATA[Suriya]]></dc:creator>
            <pubDate>Sun, 04 Aug 2024 17:28:08 GMT</pubDate>
            <atom:updated>2024-08-04T17:28:08.560Z</atom:updated>
            <content:encoded><![CDATA[<p>So, you’ve got your main domain all squared away with your hosting provider. Now, you’re ready to launch a new project as a subdomain hosted on AWS. Or maybe you’re starting from scratch with a domain registered directly with AWS. Either way, you’re in the right place to connect your URL to the world wide web. Let’s dive in!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9HvBjyPJqbEuZTv1" /><figcaption>Photo by <a href="https://unsplash.com/@edulauton?utm_source=medium&amp;utm_medium=referral">Edu Lauton</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Contents</h3><ul><li><a href="#33db">What do you need to do in AWS?</a><br>- <a href="#2431">Deployment</a><br>- <a href="#8150">Gateway</a><br>- <a href="#9063">SSL Certificate</a><br>- <a href="#1def">DNS records</a><br>- <a href="#b25b">How do I do it?</a></li><li><a href="#ea03">What do you need to do with your domain provider?</a><br>- <a href="#b599">How internet works in 2 mins</a><br>- <a href="#5b43">Update Name Server for the subdomain</a></li></ul><h3>What do you need to do in AWS?</h3><h4>Deployment</h4><p>You can deploy your code where ever you want based on your needs say <a href="https://aws.amazon.com/elasticbeanstalk/?gclid=CjwKCAjw4_K0BhBsEiwAfVVZ_8gMFRGBhMgmRHbQ9fN2G5Ozz7SB0jZ5B9zmQN0kcr9TuzEo0qYhbhoCsrcQAvD_BwE&amp;trk=b1c3dd7d-1b94-4b82-99e3-c1505e3a55fb&amp;sc_channel=ps&amp;ef_id=CjwKCAjw4_K0BhBsEiwAfVVZ_8gMFRGBhMgmRHbQ9fN2G5Ozz7SB0jZ5B9zmQN0kcr9TuzEo0qYhbhoCsrcQAvD_BwE:G:s&amp;s_kwcid=AL!4422!3!651737511569!e!!g!!elastic%20bean%20stalk!19845796021!146736269029">Elastic beanstalk</a> or <a href="https://aws.amazon.com/pm/ec2/?gclid=CjwKCAjw4_K0BhBsEiwAfVVZ_1JWSH9Bi8J-NC3ghjsyHJY0ARYQbIR2kDQrIS2aeezLi8E9huY9IRoCo38QAvD_BwE&amp;trk=36c6da98-7b20-48fa-8225-4784bced9843&amp;sc_channel=ps&amp;ef_id=CjwKCAjw4_K0BhBsEiwAfVVZ_1JWSH9Bi8J-NC3ghjsyHJY0ARYQbIR2kDQrIS2aeezLi8E9huY9IRoCo38QAvD_BwE:G:s&amp;s_kwcid=AL!4422!3!467723097970!e!!g!!aws%20ec2!11198711716!118263955828">EC2</a> or <a href="https://aws.amazon.com/fargate/">Fargate</a> or <a href="https://aws.amazon.com/pm/lambda/?gclid=CjwKCAjw4_K0BhBsEiwAfVVZ_63bEBpR4WWZFtsq7Tp8cnOg3hFKPfVi2uyqV5knTvxvpljvpiCy-BoCKlcQAvD_BwE&amp;trk=73f686c8-9606-40ad-852f-7b2bcafa68fe&amp;sc_channel=ps&amp;ef_id=CjwKCAjw4_K0BhBsEiwAfVVZ_63bEBpR4WWZFtsq7Tp8cnOg3hFKPfVi2uyqV5knTvxvpljvpiCy-BoCKlcQAvD_BwE:G:s&amp;s_kwcid=AL!4422!3!651212652666!e!!g!!amazon%20lambda!909122559!45462427876">Lambda</a>.</p><blockquote>This post does not cover which one you should use.</blockquote><h4>Gateway</h4><p>We now would need either <a href="https://aws.amazon.com/api-gateway/">API gateway</a> or <a href="https://aws.amazon.com/cloudfront/">CloudFront</a>, to connect to connect to Hosted Zone and trigger lambda.</p><h4>SSL Certificate</h4><p>AWS provides free <a href="https://medium.com/javarevisited/ssl-certificate-67b4e3bdee38">SSL certificate</a> for domains and sub-domains with <a href="https://aws.amazon.com/certificate-manager/">Certificate Manager</a>. It also provides auto renewal as well at no extra cost. Alternatively you can use you own certificate generated by third party if you need to.</p><h4>DNS records</h4><p>The <a href="https://aws.amazon.com/route53/">Route 53&#39;s</a> <strong>Hosted Zone </strong>which is the DNS zone<strong>, </strong>is where you would define the <a href="https://www.cloudflare.com/learning/dns/dns-records/">DNS records</a> like A record, CNAME record, etc.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fsg2vqJl8COQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dsg2vqJl8COQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fsg2vqJl8COQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b184433fee09766696a5805e6ca4f33f/href">https://medium.com/media/b184433fee09766696a5805e6ca4f33f/href</a></iframe><h4>How do I do it?</h4><p>Here are the steps,</p><ul><li><a href="#f26e">Setting up lambda</a></li><li><a href="#9fec">Mapping lambda to the Gateway URL</a></li><li><a href="#5e39">Creating SSL certificate</a></li><li><a href="#1d8e">Create a Route 53 Hosted zone</a></li><li><a href="#c716">Add Certificate CNAME</a></li><li><a href="#9f04">Creating the domain name in API gateway</a></li><li><a href="#5174">Map API gateway in as A record</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bG-5shqvqF3qCcoptBdkJg.png" /></figure><blockquote>For the sake of simplicity I will stick with the AWS console to explain the steps</blockquote><ul><li><strong>Setting up lambda</strong></li></ul><p>For this example, I will consider the <a href="https://aws.amazon.com/pm/lambda/?gclid=CjwKCAjw4_K0BhBsEiwAfVVZ_63bEBpR4WWZFtsq7Tp8cnOg3hFKPfVi2uyqV5knTvxvpljvpiCy-BoCKlcQAvD_BwE&amp;trk=73f686c8-9606-40ad-852f-7b2bcafa68fe&amp;sc_channel=ps&amp;ef_id=CjwKCAjw4_K0BhBsEiwAfVVZ_63bEBpR4WWZFtsq7Tp8cnOg3hFKPfVi2uyqV5knTvxvpljvpiCy-BoCKlcQAvD_BwE:G:s&amp;s_kwcid=AL!4422!3!651212652666!e!!g!!amazon%20lambda!909122559!45462427876">AWS Lambda</a><strong>. </strong>Let’s say you already have a lambda deployed. Just make sure you <strong>don’t </strong>have the <em>function URL</em> turned on. If you are unaware AWS Lambda generates its own URL when opted in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sEcnh7Gr0VzLz2pUTf96Pw.png" /></figure><ul><li><strong>Mapping lambda to the Gateway URL</strong></li></ul><p>Once you got the <a href="#f26e">Lambda</a> created, you can create the <strong>HTTP API</strong> to point to the lambda function,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LMyNO_j3Pifkw-UC9dIAFA.png" /></figure><p>Once you have created the API, then you need to map the API to the lambda, go to <strong>integrations -&gt; create an integration</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZmlfF7Yp7MpIO_DOha4Ow.png" /></figure><p>Once you have enabled it, you can now access it as a http endpoint,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vc2jEej6eBFczig1Ugx_cQ.png" /></figure><p>for example, <a href="https://b9tl7fbxi2.execute-api.us-east-2.amazonaws.com/">https://b9tl7fbxi2.execute-api.us-east-2.amazonaws.com/</a> is the default endpoint the <a href="https://aws.amazon.com/api-gateway/">API gateway</a> has created but on the end of the day we would need to map our own subdomain to this URL.</p><ul><li><strong>Creating SSL certificate</strong></li></ul><p>An <a href="https://medium.com/javarevisited/ssl-certificate-67b4e3bdee38">SSL certificate</a> is required to have the web browser use HTTPS protocol to connect to your own custom endpoint rather than using the <a href="https://aws.amazon.com/api-gateway/">API gateway</a> one provided as above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LJzDuhOMC3KRKuee" /><figcaption>Photo by <a href="https://unsplash.com/@kutanural?utm_source=medium&amp;utm_medium=referral">Kutan Ural</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>AWS provides free <a href="https://medium.com/javarevisited/ssl-certificate-67b4e3bdee38">SSL certificate</a> via <strong>AWS</strong> <strong>Certificate Manager. </strong>Alternatively you can import your own certificate generated by third party if you need to. However for this example, I will have one created using <a href="https://aws.amazon.com/certificate-manager/">Certificate Manager</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*QMpVpyvSxOWoyzxbo9-75A.png" /></figure><p>Here I will choose, <strong>DNS validation</strong>.</p><p>In case, if you select <a href="https://docs.aws.amazon.com/acm/latest/userguide/email-validation.html#how-email-validation-works">email validation</a> then if you have it <a href="https://docs.aws.amazon.com/acm/latest/userguide/email-validation.html#how-email-validation-works">registered your email with your domain provider</a> then you will get an email. In case if you have opted to hide your address, rather you receiving an email, your service provider will receive them — which might not work my case. Also note that the automatic validation will also be disabled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oiSu2KbTEGnYc6UgUDbGUg.png" /></figure><p>Now you will see <strong>Pending Validation </strong>as the status for now, however we will get there to make it success in the upcoming steps if not it gets automatically succeeded.</p><ul><li><strong>Create a Route 53 Hosted zone</strong></li></ul><p>If you got the domain registered via AWS or thru some other provider, either way you would need Hosted Zone.</p><p>To create Hosted zone, navigate to <a href="https://aws.amazon.com/route53/">Route 53</a><strong>, </strong>and <strong>create hosted zone</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*qv7fHs2ZNjYlcDqnRsAC8w.png" /></figure><blockquote><strong>Note </strong>the hosted zone is going to cost you 0.50$ per month.</blockquote><p>Once you have the Hosted zone created you would see something like,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OssrYBs51TrGmEx6sH8dvA.png" /></figure><ul><li><strong>Add Certificate CNAME</strong></li></ul><p>The primary reason CNAME records are used during SSL certificate issuance is for <strong>domain validation</strong>. It’s a way for the Certificate Authority (CA) to verify that you indeed own the domain for which you’re requesting the certificate. Now you would need to go to <strong>certificate manager </strong>and <strong>create the record in </strong><a href="https://aws.amazon.com/route53/">Route 53</a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5N8rrFmWQKsdYahucoYvnA.png" /></figure><p>The corresponding hosted zone will appear on the list select it and it will automatically add it to the <strong>route 53’s hosted zone.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*x5tMI5bPH43t90eNBmqqYQ.png" /></figure><p>When you have the certificate imported into your <strong>hosted zone</strong>,</p><p>try hitting the following from your command line,</p><p>for <strong>CNAME,</strong></p><pre>nslookup -q=cname pixie-api.suriyaprakhash.com</pre><p>for <strong>Name server</strong>,</p><pre>nslookup -q=ns pixie-api.suriyaprakhash.com</pre><p>for <strong>Start of authority(SOA)</strong>,</p><pre>nslookup -q=soa pixie-api.suriyaprakhash.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwDegWJchiWXHlLvorx3ng.png" /></figure><p>here <strong>ns-885.awsdns-46.net </strong>is the authoritative name server.</p><p>Now you would see the <strong>Success </strong>as the certificate status in the Certificate Manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5irUjOU7aydlah7HXwQqBg.png" /></figure><blockquote><strong>Note </strong>This step is only for the purpose of the certification verification &amp; issuance The CNAME record in the hosted zone is not required once the certificate the certificate is issued.</blockquote><ul><li><strong>Creating the domain name in API gateway</strong></li></ul><p>Now create the <strong>Custom domain name </strong>in the <a href="https://aws.amazon.com/api-gateway/">API gateway</a><strong>,</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*AAX54_6gF2stIeRdHShQZQ.png" /></figure><p>Note that ACM certificate will now appear on the dropdown since its been validated and the status is <strong>success</strong> for the certificate in the certificate manger.</p><ul><li><strong>Map API gateway in as A record</strong></li></ul><p>Now you would need to add the <strong>Domain Name</strong> from the <a href="https://aws.amazon.com/api-gateway/">API gateway</a> into the <a href="https://aws.amazon.com/route53/">Route 53</a> Hosted Zone as <strong>A record</strong>,</p><p>Route 53 -&gt; Hosted zone -&gt; Select the already created zone -&gt; Create record</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G8gH_XG_Cu1W8oPLGF0eQg.png" /></figure><p>Select <strong>Simple routing,</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*VV6rDe9-az2rMgnu190Hag.png" /></figure><p>Once it gets added, you would see something like this on the <strong>Hosted Zone</strong>,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g-5Uh8fbAwIy2YYaFxHJWA.png" /></figure><p>At this point, all the configuration from the AWS side is complete.</p><h3>What do you need to do with your domain provider?</h3><p>Your domain provider could be for example <a href="https://www.godaddy.com/en-ca/domains?isc=cademolv&amp;cdtl=ctv_ytv&amp;cdtl=c_21471048668.g_.a_.d_c.ctv_x&amp;gad_source=1&amp;gclid=CjwKCAjw4_K0BhBsEiwAfVVZ_w2svdoCIxDQrqBzdslNDyavlCs51ua4H6_JFs4dN_NoCQ866579vBoCEu8QAvD_BwE">Go Daddy</a>, <a href="https://www.hostinger.com/?utm_campaign=Brand-Exact|NT:Se|LO:USA&amp;utm_medium=ppc&amp;gad_source=1&amp;gclid=CjwKCAjw4_K0BhBsEiwAfVVZ_-Z__SkIMH-TvMAi1r_N1C3fmdGa9FJ--Ls9PQGXdO_s3RjgWmv-fxoCGfkQAvD_BwE">Hostinger</a>, <a href="https://www.ionos.ca/?ac=OM.CA.CA287K417301T7073a&amp;itc=74YG34XQ-TH53Y8-&amp;utm_source=google&amp;utm_medium=cpc&amp;utm_campaign=SBT-CA-BRA-MIXX---IONOS---&amp;utm_term=ionos&amp;matchtype=e&amp;utm_content=IONOS&amp;gad_source=1&amp;gclid=CjwKCAjw4_K0BhBsEiwAfVVZ_25Pt45LYaWl3qXD5F4I3ZV1wj1DtsvBX0BQC1W_vGB5TnYdxk176RoCiycQAvD_BwE&amp;gclsrc=aw.ds">IONOS</a>, etc. where you have purchased the domain or have your DNS records for your main domain.</p><p>If you already know how internet works <a href="#5b43">skip to the part where we add the AWS NS in your domain providers NS record</a>.</p><ul><li><strong>How internet works in 2 mins</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gUBJt5iObdsP-CSE" /><figcaption>Photo by <a href="https://unsplash.com/@alinnnaaaa?utm_source=medium&amp;utm_medium=referral">Alina Grubnyak</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>- Users hit the URL in the browser<br>- The request goes to the Users <a href="https://en.wikipedia.org/wiki/Domain_Name_System">DNS resolver</a>, if the domain is already cached in the DNS resolver&#39;s cache the IP is just returned to the browser<br>- If the IP is not in the cache, then it goes to the <a href="https://en.wikipedia.org/wiki/Root_name_server">Root Name Server</a> and returns back the next name server to the resolver, then resolver reaches to the next one and so on until the <a href="https://dnssec-tools.org/wiki/Authoritative_Server.html">Authoritative server</a> is landed. In more general case your domain name host provider might own the authoritative server which is returned to the resolver.<br>- Once now the browser gets the IP it reaches out to corresponding server to fetch the data/html.<br>- In this case of subdomain, your domain provider Authoritative server would need to point to the AWS Authoritative server which is listed in our case in the AWS <a href="https://aws.amazon.com/route53/">Route 53</a>’s hosted zone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M6pFmgs1fbayrK8YMIwJ0w.png" /></figure><ul><li><strong>Update Name Server for the subdomain</strong></li></ul><p>Grab the NS info from the <strong>Route 53’s Hosted zone</strong> ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wToM7U55yP-fk0ec9g5BvQ.png" /></figure><p>and insert them as a NS record in your domain providers DNS records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*FoNcIwpGJFMiSkiiAHVSbQ.png" /></figure><p>After this point you are all set to access the URL from the browser from any device from anywhere in the world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-1o1-HD3I26UYRoP" /><figcaption>Photo by <a href="https://unsplash.com/@silverkblack?utm_source=medium&amp;utm_medium=referral">Vitaly Gariev</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So, there you have it. Thanks to the internet.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e39cec83bd2" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/hosting-custom-sub-domains-in-aws-9e39cec83bd2">Hosting custom sub-domains in AWS</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WSLing Spring Boot with IDEA]]></title>
            <link>https://medium.com/javarevisited/wsling-spring-boot-with-idea-0b7bb3dbade2?source=rss-89fe0cf04a67------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b7bb3dbade2</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[localhost]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Suriya]]></dc:creator>
            <pubDate>Tue, 18 Jun 2024 14:56:08 GMT</pubDate>
            <atom:updated>2024-06-18T14:56:08.617Z</atom:updated>
            <content:encoded><![CDATA[<p>Code Your Way. On Windows!</p><p>Let’s be honest, I’m all about keeping my code organized — it makes wrangling Python, Node.js, and Java projects a breeze. For years, WSL was my go-to for that, but developing <a href="https://spring.io/projects/spring-boot">Spring Boot</a> applications in it? Yeah, not so much. Slowness, weird issues — the whole experience felt clunky. Extensions, <a href="https://webpack.js.org/concepts/hot-module-replacement/">HMR</a> with UI frameworks was also a pain, and moving files around felt like a chore, however it was not a show stopper for UI frameworks. But for Spring boot! meh!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zLCmMmzpnLLcS6GhDVDazQ.jpeg" /></figure><p>The prior versions of Idea were ok. Thankfully, upgrading to <a href="https://www.jetbrains.com/idea/">IntelliJ IDEA</a> 2024.1.3 has been a total game-changer! It’s made developing Spring Boot applications smooth sailing, and I’m itching to share my experience with you all.</p><ul><li><a href="#6b57">Answering why?</a></li><li><a href="#1475">Answering how?</a><br>- <a href="#b062">Pre-requisite</a><br>- <a href="#150e">Getting the environment ready</a><br>- <a href="#b562">IDE installation</a><br>- <a href="#15f6">Warming up</a><br>- <a href="#b8e1">Time to destroy</a><br>- <a href="#c2b1">How is this better than Dev Containers?</a><br>- <a href="#0275">Space and Memory</a></li></ul><h3>Answering why?</h3><p><a href="#1475">Skip to how</a> if you know why WSL-ing.</p><p>We juggle a ton on our PCs, right? Tracking personal software, documents, games, you name it. Add photo editing, video magic — the list goes on. But for us coders who rock Windows machines, it gets even crazier. We gotta install dev kits, <a href="https://en.wikipedia.org/wiki/Integrated_development_environment">IDEs</a>, a whole codebase jungle on top of everything else. Nightmare, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oJdXlirdHefj9UZ0" /><figcaption>Photo by <a href="https://unsplash.com/@steveungermann?utm_source=medium&amp;utm_medium=referral">Steven Ungermann</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Here’s the thing: some dev kits are a breeze to set up. Others? Total pain. You gotta configure this, tweak that, and suddenly your happy place feels like a minefield.</p><p>Wouldn’t it be awesome if we could create self-contained dev environments, like <a href="https://www.docker.com/">Docker</a> containers? Imagine having everything your project needs — tools, code, the whole shebang — wrapped up in a neat package. Need to spin up a project? Easy peasy, just fire it up. Done coding? Delete it without messing with your personal stuff. Plus, you could share these environments with others, saving them all the installation headaches. Talk about a win-win!</p><h3>Answering how?</h3><h4>Pre-requisite</h4><p>Let us assume you already got the subsystem set in your machine, the recent version <a href="https://learn.microsoft.com/en-us/windows/wsl/install">WSL2</a> and also have a flavor of <a href="https://en.wikipedia.org/wiki/List_of_Linux_distributions">Linux distro</a> installed.</p><p>Also note if you run on less 16 GB of RAM with or without swap mem this might not be the best solution handling multiple artifacts and software for development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VT0mAYFRcj3y-B_4" /><figcaption>Photo by <a href="https://unsplash.com/@andrew_hall?utm_source=medium&amp;utm_medium=referral">Andrew Hall</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you are not sure what I am talking about but got <a href="https://www.docker.com/products/docker-desktop/">docker desktop</a> into your windows recently, then you already got this installed as <strong>default</strong>.</p><h4>Getting the environment ready</h4><p>For the sake of this article I used <a href="https://ubuntu.com/">Ubuntu</a> distro. The following would show the distro list,</p><pre>wsl -l -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P5tyC0HMHTnTaHDtgbugYw.png" /></figure><p>I usually have the fresh distro saved, so we can make copies out of it to start with our fresh environment when needed.</p><pre>wsl --export ubuntu C:\Users\suriy\main\wsl\ubuntu\ubuntu.tar</pre><p>Now create the required separate self contained distro environment. This could be grouped by a project with different tech installations.</p><p>But for this example, I will go by java environment</p><pre>wsl --import ubuntu-java C:\Users\suriy\main\wsl\java C:\Users\suriy\main\wsl\ubuntu\ubuntu.tar</pre><p>Now the list should show you the newly created java container where all the dev kit and repo is going to live. This is how we we keep the environment separate — the following is based on the tech.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lvAtjZ8IWG0BlB_PURkQjg.png" /></figure><h4>IDE installation</h4><p>Note that now, we will be installing the <a href="https://www.jetbrains.com/idea/download/?section=windows">IDEA IDE</a> in our <strong><em>windows machine</em></strong>.</p><p>Hold on, aren’t we using WSL?</p><p><strong>You might be scratching your head </strong>— <em>why install IDEA on Windows if we’re using WSL?</em> That’s a fair question.</p><p>The truth is, at the time of writing, there isn’t a perfect solution for running IDEA directly within <a href="https://ubuntu.com/desktop/wsl">Ubuntu WSL</a>.</p><p>Here’s the thing, we want our development environment to work flawlessly, right? So, while WSL is awesome for many things, using IDEA directly on Windows ensures it runs exactly as expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2OoEkpZSQ_VU3lVl" /><figcaption>Photo by <a href="https://unsplash.com/@jrkorpa?utm_source=medium&amp;utm_medium=referral">Jr Korpa</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Sure, we can switch to a full-blown WSL solution when a perfect option becomes available, but for now, this approach keeps our coding workflow happy.</p><h4>Warming up</h4><p>Launch the WSL distro,</p><pre>wsl -d ubuntu-java</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YX0oHYMlL1PCuLUIdn__RA.png" /></figure><p>Alternatively, use powershell menu start the</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5k8vVNGvXxjIrS775zlzbg.png" /></figure><p>In the Idea IDE <em>(installed in windows)</em>, just import <em>(which ever way you prefer to import) </em>the existing project as you usually would after downloading it from the <a href="https://start.spring.io/">spring starter</a> or from you git repository,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBeFUNMqa9ZI2yd7U7lR-Q.png" /></figure><p>Now that we have successfully imported the project from the WSL disk, we need to try to build &amp; run it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*40TK2ca6g1wny9p6RYI2yA.png" /></figure><p>So to that we need to make sure to either <a href="https://github.com/suriyaprakhash/learning/blob/master/wsl/wsl-java.md#search-for-open-jdk">manually download</a> or use the following IDEA SDK to download JDK into the WSL distro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*2Oilen68ztW6m-xal18ncg.png" /></figure><p>Now you might see bunch of issue with respect to <a href="https://openjdk.org/">JDK</a> and <a href="https://maven.apache.org/">maven</a>. You also might see that idea might just hang switching the JDK from WSL.</p><p>To avoid that, you need to <a href="https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26">add windows security exclusion</a> to the .m2, .jdks and the JDK files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZWzZhNkLg1dORwEuKqxLcg.png" /></figure><p>Now that we added the required exclusions, you run make sure the run configuration is pointing to the right java version from the WSL and run the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_ABHHzMaLv7-gsm_96SXw.png" /></figure><p>Everything should work as how it would on a normal windows environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*4nL2I2LhKAod-MNLCbrWgg.png" /></figure><h4>Time to destroy</h4><p>When you are done with the environment, just unregister to wipe all the data from the <em>ubuntu-java</em> distro</p><pre>wsl — unregister ubuntu-java<br></pre><h4>How is this better than Dev Containers?</h4><p><a href="https://code.visualstudio.com/docs/devcontainers/containers">Dev Containers</a> leverage Docker containers to provide pre-configured development environments. They rely on a specific Docker image containing all the necessary tools and dependencies for your project. While Dev Containers are great for sharing these environments with others, WSLing can achieve a similar outcome. However, WSLing offers more fine-grained control over the environment as everything in Dev Containers needs to be packaged into an image and requires Docker to function.</p><h4>Space and Memory: What to Expect with WSL</h4><p>So, how much space and memory does WSL gobble up? It depends! The good news is you can keep an eye on things using df for disk space and <a href="https://learn.microsoft.com/en-us/shows/inside/task-manager">Task Manager</a> for memory. Just remember, WSL can be a hungry beast depending on what you throw at it, so plan your projects accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y6XCWu9wLB7e0XxslFkMiQ.jpeg" /></figure><p>If you’re concerned about managing space and memory with WSL, there are resources available online to help you optimize your setup.</p><p>Let me know in the comments if you’d like a future post with some tips on keeping your WSL environment lean and mean!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b7bb3dbade2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/wsling-spring-boot-with-idea-0b7bb3dbade2">WSLing Spring Boot with IDEA</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[mockManga: A redesigned web app for Unlimited Random Data Creation]]></title>
            <link>https://suriyaprakhash.medium.com/mockmanga-a-redesigned-web-app-for-unlimited-random-data-creation-ec5256d10f1a?source=rss-89fe0cf04a67------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec5256d10f1a</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Suriya]]></dc:creator>
            <pubDate>Sat, 11 May 2024 11:08:56 GMT</pubDate>
            <atom:updated>2024-05-11T11:08:56.543Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine bringing your product vision to life — seeing realistic customer data flow through your system. But generic datasets can’t paint a complete picture. Wouldn’t you wish to visualize your product with real-world data, fostering a clearer understanding of its functionality and user experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jobP_mMGKypSioSwmbMOaA.jpeg" /></figure><p>That’s why I built <a href="https://mockmanga.suriyaprakhash.com/">mockManga</a>.</p><h3>Contents</h3><ul><li><a href="#fa17">Say Goodbye to Data Creation Headaches</a></li><li><a href="#700b">The Perfect Tool for Developers, Testers and Non-Developers</a></li><li><a href="#6cd4">Current Culinary Canvas</a></li><li><a href="#8bf4">Evolving Recipe Book</a></li></ul><p><strong>Say Goodbye to Data Creation Headaches</strong></p><p><a href="https://mockmanga.suriyaprakhash.com/">mockManga</a> takes the pain out of generating random fake data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XvRYbuZMR4iPtgnbZGZdMw.png" /></figure><p>Here’s why it’s your new best friend:</p><ul><li><strong>Endless Possibilities:</strong> Need 10 records? 1,000? A million? mockManga handles it all. There’s no limit to the amount of data you can generate, so you can test your application to its full capacity.</li><li><strong>Customization on Autopilot:</strong> For specific fields, leverage pre-defined options within the dropdowns. Need realistic phone numbers? Select the “Phone Number” option, and mockManga generates them for you.</li><li><strong>Your Choice of Format:</strong> Need your data in JSON for your API? No problem. Want it in a CSV for easy import into your spreadsheet? mockManga delivers in both popular formats.</li><li><strong>Completely Free:</strong> mockManga is a free-to-use web application. No hidden fees, no subscriptions, just pure data generation goodness.</li></ul><p><strong>The Perfect Tool for Developers, Testers and Non-Developers</strong></p><p>Whether you’re a seasoned developer or just starting out, mockManga is a valuable tool for anyone who needs random data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRCuz9P-HcbMWhsXPeseuQ.png" /></figure><p>It’s perfect for:</p><ul><li><strong>Application Testing:</strong> Generate test data to ensure your application handles various data scenarios.</li><li><strong>Building Demos:</strong> Populate your demo application with convincing sample content.</li><li><strong>Data Exploration:</strong> Experiment with different data sets to gain insights into your application’s behavior.</li></ul><p><strong>Current Culinary Canvas</strong></p><p>There are a few things to keep in mind:</p><p><strong>CPU Appetite:</strong> As a web-based tool, mockManga relies on your device’s processing power to generate large datasets. For smaller projects, this is a breeze. However, if you’re craving a truly gargantuan feast of data, consider these options:</p><ul><li><strong>Offline Alternatives:</strong> Explore desktop-based mock data generators that leverage your computer’s full processing power for massive data creation.</li><li><strong>Cloud-Based Solutions:</strong> Some online services offer high-performance data generation, perfect for tackling truly colossal datasets.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*Jxi97cw3KH_WOppLADykPg.png" /></figure><p><strong>Predefined Options:</strong> Currently, mockManga offers a curated selection of data categories. While we’re always working on expanding this menu, for highly specialized needs, you might consider:</p><ul><li><strong>Custom Configurations:</strong> If you’re comfortable with code, you can tweak <a href="https://fakerjs.dev/">Faker.js</a> settings to generate more specific data types.</li><li><strong>Third-Party Libraries:</strong> Explore libraries like <a href="https://www.npmjs.com/package/randomatic">Randomatic.js</a> or Casual which offer a wider range of pre-defined data types.</li></ul><p><strong>Evolving Recipe Book</strong></p><p>Rest assured, I will be constantly refining the recipe book! The next release will feature an even more extensive selection of pre-defined data categories, making it easier to craft the perfect data dish for your specific needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*G8sMuntwkxw1t0US" /><figcaption>Photo by <a href="https://unsplash.com/@kaleidico?utm_source=medium&amp;utm_medium=referral">Kaleidico</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So ditch the manual data creation and try mockManga. With its minimalistic look, easy to use experience, and free-to-use nature, <a href="https://mockmanga.suriyaprakhash.com/">mockManga</a> is the ultimate random data generation solution.</p><p>Get started today and see how it can streamline your development workflow!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec5256d10f1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The art of being a successful Software Developer]]></title>
            <link>https://levelup.gitconnected.com/the-art-of-being-a-successful-software-developer-edd41554d1fd?source=rss-89fe0cf04a67------2</link>
            <guid isPermaLink="false">https://medium.com/p/edd41554d1fd</guid>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[success]]></category>
            <dc:creator><![CDATA[Suriya]]></dc:creator>
            <pubDate>Tue, 02 Apr 2024 22:32:31 GMT</pubDate>
            <atom:updated>2024-04-02T22:32:31.660Z</atom:updated>
            <content:encoded><![CDATA[<p>Traits to be Successful!</p><blockquote>When some one asks you, if you are successful developer? What would be your answer?</blockquote><p>Successful? How do you measure the state of being successful?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3ORIWTreqB8_Govp" /><figcaption>Photo by <a href="https://unsplash.com/ko/@vietnambeautiful?utm_source=medium&amp;utm_medium=referral">VietNam Beautiful</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When you think about it, different parameters shows up right away. Such as, getting paid, career growth, stable work environment, better work life balance, the list goes on and on. However, the answer is quite simple,</p><blockquote>“Success is always relative”.</blockquote><p>Despite <em>success being relative </em>and it being individual specific, are there any common set of etiquette that a developer should possess irrespective of the above parameters?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I5goa8HUO9JXH1hc" /><figcaption>Photo by <a href="https://unsplash.com/@cathrynlavery?utm_source=medium&amp;utm_medium=referral">Cathryn Lavery</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Being over a decade in the industry and experiencing it, I would like to share my thoughts and approach that might be helpful to some one, if not everyone who reads this.</p><h3>Contents</h3><ul><li><a href="#874a">Start small</a></li><li><a href="#c62b">Learn while you do</a></li><li><a href="#Language syntax is spontaneous">Syntax will be spontaneous</a></li><li><a href="#82fc">Try breaking things</a></li><li><a href="#4742">The everything</a></li><li><a href="#5cf6">Divide and Conquer</a></li><li><a href="#9bb5">Question yourselves</a></li><li><a href="#c802">Find the answers yourself</a></li><li><a href="#84d7">Being Search wizard</a></li><li><a href="#4510">Learn &amp; Unlearn</a></li><li><a href="#d254">Listen to others</a></li><li><a href="#0a9b">Accept failure</a></li></ul><h3>Start small</h3><p>I think this applies to anything in life.</p><p>But with programming, it helps to build the <strong>confidence </strong><em>ten fold</em>. You would unquestionably realize it the very moment, when the three lines of code you wrote, works.</p><blockquote>When you try to build the whole house by yourself in the very first day, there is a higher chance that you would give up, considering the difficulty.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F877oJZryxW-qEMY" /><figcaption>Photo by <a href="https://unsplash.com/@celinehaeberly?utm_source=medium&amp;utm_medium=referral">Céline Haeberly</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Learn while you do</h3><p>I had 4 years of <strong>Information Technology classes </strong>in my <em>bachelor’s degree, </em>I was assuming that I am ready to tackle whatever is thrown at me, until I ended up burning midnight oil, <em>figuring the root cause</em> and <em>fixing</em> critical bugs or <em>solving a downtime </em>in very high volume, high traffic production applications.</p><p>The truth is, Software Engineering is not just knowing how to design systems &amp; code.</p><blockquote>You need to be in the waters to learn how to swim. Standing on the ground and trying to learn swimming doesn’t work.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lRIgZoEPi0ajLNnR" /><figcaption>Photo by Tommaso Fornoni on Unsplash</figcaption></figure><p>So, chapter by chapter is good until we learn the basics.</p><blockquote>Implementation in real time would actually teach us the rest of the chapters in the book and also the chapters that are missing from the book.</blockquote><p>I personally feel like courses should be taken on demand or else we will end up forgetting things.</p><p>I feel that you don’t need to acquire a degree in computer science to be a coder. Sadly, it has become an industry standard as a first degree scrutiny in most places.</p><h3>Language syntax is spontaneous</h3><p>When you see someone coding fast or doing a task faster than you don’t be discouraged. Its like a boomerang, you have to do your part.</p><blockquote>Learning syntax of a language is like, learning to ride a Motor bike.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bgr4aUGkfWYi1bjn" /><figcaption>Photo by <a href="https://unsplash.com/@harleydavidson?utm_source=medium&amp;utm_medium=referral">Harley-Davidson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Once you know how to ride, would not never realize when your foot starts shifting gears.</p><p>Everyone writes <em>crappy code</em>, <strong>how crappy is it? </strong>is what matters. Make sure the crap code you write today is less crappier than the one you wrote the previous year.</p><h3>Try breaking things</h3><p>If something is broken unexpectedly, then thank it for being broken under your watch, now you got the chance to understand it and fix it.</p><p>Only when you break things, you would know how to fix it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*egwl9UA2v-jcoKoM" /><figcaption>Photo by <a href="https://unsplash.com/@reskp?utm_source=medium&amp;utm_medium=referral">Jametlene Reskp</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>Lifeboats would seem like an optional payload, unless you drown sinking without it.</blockquote><p><strong>127.0.0.1</strong> is the best thing ever.</p><h3>The Everything</h3><p>You can fit everything that you do in the industry into the following,</p><ul><li><strong>Input — </strong>Understand what is the ask</li><li><strong>Process — </strong>Determine how and do it</li><li><strong>Output — </strong>Check if it is the desired result, if not start over again.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*o6hgzoqpyWcVscbj" /><figcaption>Photo by <a href="https://unsplash.com/@thoughtcatalog?utm_source=medium&amp;utm_medium=referral">Thought Catalog</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Understanding these 3 makes it easier to streamline the tasks. Know how long would it take to finish it and to determine what’s next.</p><h3>Divide and conquer</h3><p>When you find a problem huge and hard to solve, try breaking it down to smaller chucks.</p><blockquote>Try solving pieces, one at a time</blockquote><p>It will grow confidence and will boost your energy mentally to navigate further.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZXiwC6jvSR4Uu2Yr" /><figcaption>Photo by <a href="https://unsplash.com/@kellysikkema?utm_source=medium&amp;utm_medium=referral">Kelly Sikkema</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It will also give you a bigger picture of the problem, sort what’s necessary and also could help narrow down to the target.</p><h3>Question yourselves</h3><p>Ask questions even if it is working as expected. You never know what you might have missed.</p><p>At the same time, too many questions thriving you to find answers might sometimes take life time to figure out and would make you feel like a stagnant water.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eIyH8c1rqhsuFztQ" /><figcaption>Photo by <a href="https://unsplash.com/@tingeyinjurylawfirm?utm_source=medium&amp;utm_medium=referral">Tingey Injury Law Firm</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When that happens, move on.</p><blockquote>One cannot learn everything the world has to offer in a lifetime.</blockquote><p>Who knows you might understand it sometime in future. I wasn’t certain why I learned the formula for Compound interest in school until I started vesting.</p><h3>Find the answers yourself</h3><p>The following is the most important thing,</p><blockquote>Try to read and understand the error message. Do not copy paste the error stack directly into google search or ask someone right away.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LL_fmvqGm5a-b0vz" /><figcaption>Photo by Rabie Madaci on Unsplash</figcaption></figure><p>90% of people fail at reading, what the error message says so.</p><p>Try to <strong>find answers yourself</strong> before you ask someone about it.</p><p>So, you can at least explain them better, what actually has happened and what you did so far, if you couldn’t address it yourself.</p><p>Once you have found the first answer yourself, it would encourage you to find answers to further questions when they arise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KlFckIAuR6rBkfVo" /><figcaption>Photo by Ruben Leija on Unsplash</figcaption></figure><p>This would also help you in a long run, when your are in a position where you are supposed to help others.</p><h3>Know what to search for</h3><p>I am not talking about, searching and copy pasting the code from the internet. Most of us, <a href="https://www.google.com/">google</a> and will only look at the first few links in the first page ending up in the <a href="https://stackoverflow.com/">stack overflow</a> or <a href="https://stackexchange.com/">stack exchange</a>.</p><p>If you do so, you should<strong> reverse the search strategy</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eKMqeayzknTvvUnU" /><figcaption>Photo by <a href="https://unsplash.com/@beccatapert?utm_source=medium&amp;utm_medium=referral">Becca Tapert</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Look for documentation first, git hub repo, related official links pointing to forums/articles and then the stack overflow.</p><p>This way you know what exactly you are looking for and even you might end up providing a better answer to the same question in the <em>stack overflow</em> <strong>after reading the documentation</strong>.</p><p>To add more fuel to the fire, now you can also rely on Generative Pre-trained Transformers for small code snippets. However, it might not come handy if the place you work doesn’t allow it yet.</p><h3>Learn &amp; Unlearn</h3><p>People will just say technology keeps changing, keep up with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ha2Bcg78UOnfhYsj" /><figcaption>Photo by <a href="https://unsplash.com/ko/@nikkotations?utm_source=medium&amp;utm_medium=referral">nikko macaspac</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>But, I know what it feels like to a typical person, when that person is super familiar with a certain technology that is on the verge of dying tomorrow and is in pressure that squeezes them to learn new things.</p><p>But in reality, if you feel the stress, then you are not doing it right. If you don’t love what you do, try to switch to something that you like to do.</p><blockquote><em>The curiosity of how it works or how it didn’t work should not let you sleep or eat. At the same time it should not become overwhelming.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wfSFaXAhTyWo4QuR" /><figcaption>Photo by Tricia Galvin on Unsplash</figcaption></figure><p>In the industry, things that we learn today will not be the same the next year, if not the very next day.</p><h3>Listen to other</h3><p>Sometimes design discussions could derail, but in most cases it would be fruitful. Open up your design ideas, at the same time be patient to listen to other’s ideas and do not force your opinions.</p><p>Pair programming, is something every software company should endorse.</p><p>If you don’t have such an opportunity, try to create one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*71HYkMUnFRdKhD_2" /><figcaption>Photo by <a href="https://unsplash.com/@roller1?utm_source=medium&amp;utm_medium=referral">kyle smith</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It helps in a lot of ways say,</p><ul><li>New coding style</li><li>How to debug better?</li><li>How to use shortcuts in IDEs?</li><li>How do others approach a problem?</li><li>How to explain things?</li><li>How to code better using collective intelligence?</li><li>Tools that you never thought about or even googling about it.</li></ul><p>Again not everything is in the book or from the course that you took. It could be an eye opener for some one who was doing it differently all the time.</p><h3>Accept Failure</h3><p>Never be afraid to accept failure and move on, its not the end of the world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VZUCF_HXL7WvN_hh" /><figcaption>Photo by <a href="https://unsplash.com/@theblowup?utm_source=medium&amp;utm_medium=referral">the blowup</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You would have at least learnt, how to better tackle it the very next time it happens or may be it would be helpful in your next job, where people don’t even know about it.</p><blockquote>“Success is always relative, so is failure.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edd41554d1fd" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/the-art-of-being-a-successful-software-developer-edd41554d1fd">The art of being a successful Software Developer</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>