<?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 Shubhamsapkal on Medium]]></title>
        <description><![CDATA[Stories by Shubhamsapkal on Medium]]></description>
        <link>https://medium.com/@shubhamsapkal.dev?source=rss-6b6f6392a96f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QvYHBi52747GCw5b</url>
            <title>Stories by Shubhamsapkal on Medium</title>
            <link>https://medium.com/@shubhamsapkal.dev?source=rss-6b6f6392a96f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 08:59:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shubhamsapkal.dev/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[Fix VirtualBox VERR_VM_DRIVER_NOT_INSTALLED on Ubuntu with Secure Boot Enabled]]></title>
            <link>https://medium.com/@shubhamsapkal.dev/fix-virtualbox-verr-vm-driver-not-installed-on-ubuntu-with-secure-boot-enabled-540c33ae98b1?source=rss-6b6f6392a96f------2</link>
            <guid isPermaLink="false">https://medium.com/p/540c33ae98b1</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[ubuntu-virtual-box]]></category>
            <dc:creator><![CDATA[Shubhamsapkal]]></dc:creator>
            <pubDate>Sun, 04 Oct 2026 17:16:57 GMT</pubDate>
            <atom:updated>2026-10-04T17:16:57.984Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re trying to start a Windows VM in VirtualBox on Ubuntu and suddenly get an error like this:</p><pre>The VirtualBox Linux kernel driver is either not loaded or not set up correctly.</pre><pre>Please try setting it up again by executing:</pre><pre>&#39;/sbin/vboxconfig&#39;</pre><pre>as root.</pre><p>followed by:</p><pre>VERR_VM_DRIVER_NOT_INSTALLED (-1908)<br>The support driver is not installed.</pre><pre>On linux, open returned ENOENT.</pre><p>Don’t immediately reinstall VirtualBox.</p><p>In my case, the actual problem was <strong>UEFI Secure Boot rejecting the VirtualBox kernel module</strong>.</p><p>This post explains how to fix it while <strong>keeping Secure Boot enabled</strong>.</p><h3>The actual error</h3><p>When I tried to start my Windows VM, VirtualBox failed with:</p><pre>VERR_VM_DRIVER_NOT_INSTALLED (-1908)</pre><p>Running:</p><pre>sudo modprobe vboxdrv</pre><p>gave me the more useful error:</p><pre>modprobe: ERROR: could not insert &#39;vboxdrv&#39;: Key was rejected by service</pre><p>That message is the key.</p><h3>What does Key was rejected by service mean?</h3><p>Linux is trying to load the vboxdrv kernel module, but Secure Boot doesn&#39;t trust the module&#39;s signing key.</p><p>So the problem isn’t necessarily that vboxdrv is missing.</p><p>The module can exist perfectly fine, but the kernel will refuse to load it if it isn’t signed by a trusted key.</p><h3>Step 1: Check Secure Boot</h3><p>Run:</p><pre>mokutil --sb-state</pre><p>If you see:</p><pre>SecureBoot enabled</pre><p>and:</p><pre>sudo modprobe vboxdrv</pre><p>returns:</p><pre>Key was rejected by service</pre><p>then Secure Boot is almost certainly the reason.</p><h3>Step 2: Check that VirtualBox modules exist</h3><p>Run:</p><pre>find /lib/modules/$(uname -r) -type f -name &#39;vbox*.ko*&#39;</pre><p>You should see modules similar to:</p><pre>/lib/modules/&lt;kernel&gt;/misc/vboxdrv.ko<br>/lib/modules/&lt;kernel&gt;/misc/vboxnetflt.ko<br>/lib/modules/&lt;kernel&gt;/misc/vboxnetadp.ko</pre><p>These are the important VirtualBox host modules.</p><p>For example, my system had:</p><pre>/lib/modules/7.0.0-34-generic/misc/vboxdrv.ko<br>/lib/modules/7.0.0-34-generic/misc/vboxnetflt.ko<br>/lib/modules/7.0.0-34-generic/misc/vboxnetadp.ko</pre><p>This confirmed that the modules were present.</p><h3>Step 3: Create a MOK signing key</h3><p>Instead of disabling Secure Boot, we can create our own signing key and enroll it as a <strong>Machine Owner Key (MOK)</strong>.</p><p>Become root:</p><pre>sudo -i</pre><p>Create a directory:</p><pre>mkdir -p /root/module-signing<br>cd /root/module-signing</pre><p>Generate the certificate and private key:</p><pre>openssl req -new -x509 -newkey rsa:2048 \<br>  -keyout MOK.priv \<br>  -outform DER \<br>  -out MOK.der \<br>  -nodes \<br>  -days 36500 \<br>  -subj &quot;/CN=VirtualBox Kernel Module Signing/&quot;</pre><p>This creates:</p><pre>/root/module-signing/MOK.priv<br>/root/module-signing/MOK.der</pre><h3>Important</h3><p>MOK.priv is your <strong>private signing key</strong>.</p><p>Keep it secure. Don’t upload it to GitHub or share it publicly.</p><h3>Step 4: Enroll the MOK certificate</h3><p>Run:</p><pre>mokutil --import /root/module-signing/MOK.der</pre><p>You’ll be asked to create a temporary password.</p><p>For example:</p><pre>input password:<br>input password again:</pre><p>Remember this password.</p><p>You’ll need it during the next reboot when the MOK enrollment screen appears.</p><p>You can verify that the key is waiting for enrollment:</p><pre>mokutil --list-new</pre><p>You should see your certificate information.</p><h3>Step 5: Sign the VirtualBox kernel modules</h3><p>Find your current kernel:</p><pre>uname -r</pre><p>For example:</p><pre>7.0.0-34-generic</pre><p>Make sure kmodsign is available:</p><pre>which kmodsign</pre><p>It should return something like:</p><pre>/usr/bin/kmodsign</pre><p>Now sign the three important VirtualBox modules.</p><h3>Sign vboxdrv</h3><pre>kmodsign sha256 MOK.priv MOK.der \<br>  /lib/modules/$(uname -r)/misc/vboxdrv.ko</pre><h3>Sign vboxnetflt</h3><pre>kmodsign sha256 MOK.priv MOK.der \<br>  /lib/modules/$(uname -r)/misc/vboxnetflt.ko</pre><h3>Sign vboxnetadp</h3><pre>kmodsign sha256 MOK.priv MOK.der \<br>  /lib/modules/$(uname -r)/misc/vboxnetadp.ko</pre><h3>Step 6: Verify the module signature</h3><p>Before rebooting, verify that vboxdrv has the signature:</p><pre>modinfo /lib/modules/$(uname -r)/misc/vboxdrv.ko | grep -E &#39;signer|sig_id&#39;</pre><p>You should see something similar to:</p><pre>signer:         VirtualBox Kernel Module Signing<br>sig_id:         PKCS#7</pre><p>This confirms that the module has been signed.</p><h3>Step 7: Update the module database</h3><p>Run:</p><pre>depmod -a</pre><p>At this point, the modules are signed, but the key still needs to be trusted by the system.</p><h3>Step 8: Reboot and enroll the MOK</h3><p>Reboot:</p><pre>sudo systemctl reboot</pre><p>If Ubuntu says:</p><pre>Operation inhibited by &quot;gnome-session-s&quot;<br>reason is &quot;user session inhibited&quot;</pre><p>you can close your applications and try:</p><pre>systemctl reboot</pre><p>If necessary:</p><pre>systemctl reboot --ignore-inhibitors</pre><h3>Step 9: Enroll the key during boot</h3><p>During the next boot, you should see a blue <strong>MOK Manager</strong> screen.</p><p>Choose:</p><pre>Enroll MOK<br>    ↓<br>Continue<br>    ↓<br>Yes<br>    ↓<br>Enter the password you created earlier<br>    ↓<br>Reboot</pre><p>This step is extremely important.</p><p>If you don’t enroll the MOK, Secure Boot will continue rejecting the VirtualBox modules.</p><h3>Step 10: Verify everything after reboot</h3><p>Once Ubuntu starts again:</p><h3>Check Secure Boot</h3><pre>mokutil --sb-state</pre><p>It should still say:</p><pre>SecureBoot enabled</pre><p>We haven’t disabled Secure Boot.</p><h3>Check that your MOK is enrolled</h3><pre>mokutil --list-enrolled | grep -A2 -B2 &quot;VirtualBox Kernel Module Signing&quot;</pre><h3>Load the VirtualBox driver</h3><pre>sudo modprobe vboxdrv</pre><p>If there is no error, that’s a good sign.</p><p>Finally:</p><pre>lsmod | grep vbox</pre><p>You should see modules such as:</p><pre>vboxdrv<br>vboxnetadp<br>vboxnetflt</pre><h3>That’s it 🎉</h3><p>At this point, VirtualBox should be able to start your Windows VM normally.</p><p>You can verify by launching VirtualBox and starting your VM again.</p><h3>Why does this happen?</h3><p>With Secure Boot enabled, the Linux kernel verifies kernel modules before allowing them to load.</p><p>VirtualBox requires kernel modules such as:</p><pre>vboxdrv<br>vboxnetflt<br>vboxnetadp</pre><p>If the kernel doesn’t trust the signing key associated with those modules, it refuses to load them.</p><p>That’s why you can have:</p><pre>vboxdrv.ko</pre><p>physically present on your system and still receive:</p><pre>VERR_VM_DRIVER_NOT_INSTALLED</pre><p>The important distinction is:</p><p><strong>Module missing</strong> ≠ <strong>Module rejected</strong></p><p>In this case:</p><pre>Module exists<br>       ↓<br>Secure Boot checks signature<br>       ↓<br>Signature isn&#39;t trusted<br>       ↓<br>Kernel rejects module<br>       ↓<br>VirtualBox reports VERR_VM_DRIVER_NOT_INSTALLED</pre><h3>Quick troubleshooting checklist</h3><p>If you encounter this problem, check these in order:</p><h3>1. Is Secure Boot enabled?</h3><pre>mokutil --sb-state</pre><h3>2. Does the module exist?</h3><pre>find /lib/modules/$(uname -r) -name &#39;vboxdrv.ko*&#39;</pre><h3>3. Can the module load?</h3><pre>sudo modprobe vboxdrv</pre><p>If you get:</p><pre>Key was rejected by service</pre><p>check Secure Boot/MOK.</p><h3>4. Is the module signed?</h3><pre>modinfo /lib/modules/$(uname -r)/misc/vboxdrv.ko | grep signer</pre><h3>5. Is your MOK enrolled?</h3><pre>mokutil --list-enrolled</pre><h3>6. Try loading the driver again</h3><pre>sudo modprobe vboxdrv</pre><h3>Alternative: Disable Secure Boot</h3><p>Another solution is to disable Secure Boot from your BIOS/UEFI settings.</p><p>However, I prefer the MOK approach because it allows you to:</p><ul><li>Keep Secure Boot enabled</li><li>Maintain the security benefits of Secure Boot</li><li>Run VirtualBox normally</li><li>Explicitly trust the modules you are signing</li></ul><p>So if you don’t have a specific reason to disable Secure Boot, <strong>signing and enrolling the VirtualBox modules is a cleaner solution</strong>.</p><h3>One important thing after kernel updates</h3><p>There’s one thing to keep in mind.</p><p>When your Linux kernel or VirtualBox installation changes, VirtualBox may rebuild its kernel modules.</p><p>If a newly built module isn’t signed with your trusted MOK, you may see the same error again:</p><pre>Key was rejected by service</pre><p>If that happens, check:</p><pre>uname -r</pre><p>and:</p><pre>find /lib/modules/$(uname -r) -name &#39;vbox*.ko*&#39;</pre><p>Then check whether the newly generated vboxdrv module has a valid signature.</p><p>You may need to sign the newly built modules again.</p><h3>Final takeaway</h3><p>If you’re seeing:</p><pre>VERR_VM_DRIVER_NOT_INSTALLED (-1908)</pre><p>and:</p><pre>modprobe: ERROR: could not insert &#39;vboxdrv&#39;: Key was rejected by service</pre><p>while:</p><pre>SecureBoot enabled</pre><p>don’t immediately reinstall VirtualBox.</p><p>The likely issue is <strong>Secure Boot rejecting the VirtualBox kernel modules</strong>.</p><p>Creating a MOK, signing the VirtualBox modules, enrolling the MOK, and rebooting allows VirtualBox to work while keeping Secure Boot enabled.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=540c33ae98b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Spring Boot to a Production VPS: Nginx, Firewall, Rate Limiting and SSL]]></title>
            <link>https://medium.com/@shubhamsapkal.dev/deploying-spring-boot-to-a-production-vps-nginx-firewall-rate-limiting-and-ssl-b594f1a9e882?source=rss-6b6f6392a96f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b594f1a9e882</guid>
            <category><![CDATA[spring-boot-deployment]]></category>
            <category><![CDATA[vps]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Shubhamsapkal]]></dc:creator>
            <pubDate>Fri, 25 Sep 2026 12:47:28 GMT</pubDate>
            <atom:updated>2026-09-25T12:47:28.969Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HOs_3Yc5ebOSPq-LvtmK0Q.png" /></figure><p>Getting a Spring Boot app to run on your laptop is the easy part. Getting it to run safely on the open internet, where anyone with a port scanner can find it, is a different problem entirely. This is the gap most tutorials skip — they show you mvn spring-boot:run and call it done. Production is not localhost:8080 with no firewall, no HTTPS, and no protection against someone hammering your /login endpoint 10,000 times a minute.</p><p>This post walks through the full path: renting a VPS, running your app as a proper background service, locking down the firewall, putting Nginx in front of it, adding rate limiting, and wrapping the whole thing in HTTPS.</p><h3>Step 1: Get a VPS and connect to it</h3><p>Any VPS provider works here — Hostinger, DigitalOcean, Hetzner, Linode. Spin up a fresh Ubuntu instance (22.04 or newer), grab the IP address, and SSH in:</p><pre>ssh root@your_server_ip</pre><p>The first thing to do on a brand-new server is create a non-root user. Running your entire stack as root is asking for trouble — one mistake in a script and you’ve wiped or exposed the whole box.</p><pre>adduser deploy<br>usermod -aG sudo deploy</pre><p>Log out, log back in as deploy, and do everything from here on as that user, prefixing commands with sudo when you need elevated access.</p><h3>Step 2: Install Java and prepare the server</h3><p>Spring Boot needs a JDK on the server. Install it along with a few essentials:</p><pre>sudo apt update &amp;&amp; sudo apt upgrade -y<br>sudo apt install -y openjdk-21-jdk unzip curl<br>java -version</pre><p>Match the JDK version to whatever your project targets — if your pom.xml or build.gradle says Java 17, install 17, not whatever happens to be newest.</p><h3>Step 3: Build the jar and move it to the server</h3><p>Locally, package your application:</p><pre>mvn clean package -DskipTests</pre><p>That produces a fat jar under target/. Copy it to the server with scp:</p><pre>scp target/your-app-0.0.1-SNAPSHOT.jar deploy@your_server_ip:/home/deploy/app.jar</pre><p>You could also clone the repo directly onto the server and build there, which is often cleaner for repeatable deployments, but copying the built artifact is the fastest way to get something running.</p><h3>Step 4: Run it as a systemd service, not a raw process</h3><p>Running java -jar app.jar in an SSH session is a trap — the moment you close the terminal, the app dies. What you actually want is a systemd service, so the app starts on boot and restarts automatically if it crashes.</p><p>Create a service file:</p><pre>sudo nano /etc/systemd/system/springapp.service</pre><pre>[Unit]<br>Description=Spring Boot Application<br>After=network.target</pre><pre>[Service]<br>User=deploy<br>ExecStart=/usr/bin/java -jar /home/deploy/app.jar<br>SuccessExitStatus=143<br>Restart=always<br>RestartSec=5</pre><pre>[Install]<br>WantedBy=multi-user.target</pre><p>Enable and start it:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable springapp<br>sudo systemctl start springapp<br>sudo systemctl status springapp</pre><p>Your app is now running as a managed background service, bound to localhost:8080 (or whatever port you configured). It is not yet reachable from the outside world — which is exactly what we want at this stage.</p><h3>Step 5: Lock down the firewall</h3><p>Before you open anything to the internet, set up UFW (Uncomplicated Firewall) and default to denying everything except what you explicitly need.</p><pre>sudo ufw default deny incoming<br>sudo ufw default allow outgoing<br>sudo ufw allow OpenSSH<br>sudo ufw allow &#39;Nginx Full&#39;<br>sudo ufw enable<br>sudo ufw status</pre><p>Notice port 8080 is never opened here. The Spring Boot app stays reachable only from the server itself — the public internet will only ever talk to Nginx, which then forwards traffic internally. This one habit closes off a huge class of “someone found my app directly and skipped all my security” problems.</p><h3>Step 6: Put Nginx in front as a reverse proxy</h3><p>Install Nginx and configure it to forward incoming traffic to your Spring Boot app:</p><pre>sudo apt install -y nginx</pre><pre>sudo nano /etc/nginx/sites-available/springapp</pre><pre>server {<br>    listen 80;<br>    server_name your_domain.com;</pre><pre>    location / {<br>        proxy_pass <a href="http://localhost:8080;">http://localhost:8080;</a><br>        proxy_set_header Host $host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>    }<br>}</pre><p>Enable the site and reload:</p><pre>sudo ln -s /etc/nginx/sites-available/springapp /etc/nginx/sites-enabled/<br>sudo nginx -t<br>sudo systemctl reload nginx</pre><p>At this point, visiting http://your_domain.com routes through Nginx straight to your Spring Boot app. Nginx also gives you a clean place to add caching, compression, and — next — rate limiting, without touching a line of Java.</p><h3>Step 7: Add rate limiting</h3><p>Nginx can throttle requests per IP address using a shared memory zone, which stops both accidental traffic spikes and deliberate abuse (brute-force login attempts, scraping) before they ever reach your JVM.</p><p>Define a limit zone in the main config:</p><pre>sudo nano /etc/nginx/nginx.conf</pre><p>Inside the http block:</p><pre>limit_req_zone $binary_remote_addr zone=applimit:10m rate=10r/s;</pre><p>Then apply it inside your site’s location block:</p><pre>location / {<br>    limit_req zone=applimit burst=20 nodelay;<br>    proxy_pass http://localhost:8080;<br>    proxy_set_header Host $host;<br>    proxy_set_header X-Real-IP $remote_addr;<br>    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>    proxy_set_header X-Forwarded-Proto $scheme;<br>}</pre><p>This allows 10 requests per second per IP, with bursts up to 20 before Nginx starts rejecting with a 503. Tune the numbers to your actual traffic pattern — an internal admin API and a public signup endpoint don’t need the same limits.</p><pre>sudo nginx -t<br>sudo systemctl reload nginx</pre><h3>Step 8: Enable HTTPS with Let’s Encrypt</h3><p>No production API should be serving plain HTTP. Certbot makes this close to a one-command fix.</p><pre>sudo apt install -y certbot python3-certbot-nginx<br>sudo certbot --nginx -d your_domain.com</pre><p>Certbot edits your Nginx config automatically, obtains a free certificate from Let’s Encrypt, and sets up HTTP-to-HTTPS redirection. Confirm auto-renewal is scheduled, since certificates expire every 90 days:</p><pre>sudo certbot renew --dry-run</pre><p>If that dry run succeeds, you’re done — renewal happens quietly in the background from here on.</p><h3>Step 9: Verify everything end-to-end</h3><p>A quick checklist before you call it production-ready:</p><ul><li>sudo ufw status — only SSH and Nginx ports should be open</li><li>curl -I https://your_domain.com — should return a valid response over HTTPS</li><li>Hit the app with a quick burst of requests to confirm rate limiting kicks in (you should start seeing 503s past your configured threshold)</li><li>sudo systemctl status springapp — confirm it&#39;s active and set to restart on failure</li><li>Reboot the server once and check everything comes back up on its own</li></ul><h3>Why each layer matters</h3><p>It’s worth being explicit about what each piece is actually buying you, because it’s easy to treat this as a checklist rather than a design:</p><ul><li><strong>The firewall</strong> limits your attack surface to exactly two doors: SSH and web traffic. Nothing else is reachable, including your app’s raw port.</li><li><strong>Nginx as a reverse proxy</strong> decouples your public-facing domain from your app’s internal details, and gives you a single place to manage TLS, headers, and traffic shaping without redeploying Java code.</li><li><strong>Rate limiting</strong> protects the thing that’s actually expensive to run — your JVM and database — from being overwhelmed by either malicious traffic or an innocent retry loop gone wrong.</li><li><strong>HTTPS</strong> isn’t optional politeness anymore; browsers flag plain HTTP sites, and anything handling login credentials or user data over unencrypted HTTP is a liability.</li></ul><p>None of these individually is complicated. Stacked together, they turn a Spring Boot jar running on a bare VPS into something you could reasonably call a production deployment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b594f1a9e882" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Spring AI: A Java Developer’s Way Into the AI World]]></title>
            <link>https://medium.com/@shubhamsapkal.dev/getting-started-with-spring-ai-a-java-developers-way-into-the-ai-world-2afc0169a195?source=rss-6b6f6392a96f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2afc0169a195</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[spring-ai]]></category>
            <dc:creator><![CDATA[Shubhamsapkal]]></dc:creator>
            <pubDate>Fri, 25 Sep 2026 12:41:32 GMT</pubDate>
            <atom:updated>2026-09-25T12:41:32.848Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6oD3bCfBZ6Lkhru9vC_XqA.png" /></figure><p>If you’ve spent the last couple of years watching Python swallow up every AI tutorial on the internet, you’re not alone. Most of the LLM tooling — LangChain, LlamaIndex, every RAG walkthrough on YouTube — assumes you’re writing Python. If you’re a Java developer, that’s frustrating, because chances are your actual production systems, the ones handling real traffic and real data, are written in Java and built on Spring.</p><p>That’s the gap Spring AI is closing.</p><h3>What Spring AI Actually Is</h3><p>Spring AI is an official Spring project, built by the same team behind Spring Boot and Spring Data, and it follows the same philosophy: give developers a consistent, portable API instead of forcing them to learn a new SDK for every vendor. Just like Spring Data lets you swap Postgres for MongoDB without rewriting your repository layer, Spring AI lets you swap OpenAI for Anthropic, or Ollama for Azure, without rewriting your application logic.</p><p>At its core, the problem Spring AI solves is simple to state and annoying to solve yourself: connecting your enterprise data and APIs to an AI model, in a way that’s testable, observable, and doesn’t lock you into one provider.</p><p>It supports all the major model providers — OpenAI, Anthropic, Google, Amazon, Microsoft, and local options through Ollama — along with a long list of vector database integrations (Postgres/PGVector, Redis, MongoDB Atlas, Pinecone, Qdrant, Neo4j, and more). You write your code once against Spring AI’s abstractions, and the underlying provider becomes a configuration detail rather than a rewrite.</p><h3>The Core Building Block: ChatClient</h3><p>Everything in Spring AI revolves around ChatClient, which is intentionally designed to feel like RestTemplate or WebClient — a fluent, familiar API if you&#39;ve built Spring apps before.</p><p>Here’s what a minimal chat interaction looks like:</p><pre>@RestController<br>public class ChatController {</pre><pre>    private final ChatClient chatClient;</pre><pre>    public ChatController(ChatClient.Builder builder) {<br>        this.chatClient = builder.build();<br>    }</pre><pre>    @GetMapping(&quot;/ask&quot;)<br>    public String ask(@RequestParam String question) {<br>        return chatClient.prompt()<br>                .user(question)<br>                .call()<br>                .content();<br>    }<br>}</pre><p>No SDK gymnastics, no manually building HTTP requests to a model provider’s REST API. You inject a builder, configure your model provider in application.properties, and you&#39;re making real model calls within a standard Spring Boot app.</p><h3>Why This Matters Beyond the Toy Example</h3><p>The interesting part isn’t the “hello world” chat call — it’s what Spring AI gives you once you need to build something real:</p><p><strong>Tool calling.</strong> You can annotate a plain Java method with @Tool, and the model can decide to call it mid-conversation — checking inventory, hitting an internal API, querying a database — and Spring AI handles the round trip between the model and your code automatically. This is what turns a chatbot into an agent that can actually do things.</p><p><strong>RAG (retrieval-augmented generation).</strong> Rather than hoping the model already knows about your company’s internal docs, Spring AI’s vector store abstraction lets you embed and retrieve your own data, then inject it into the prompt. It ships with a portable API across vector databases, including a SQL-like metadata filter syntax, so switching from Pinecone to PGVector later doesn’t mean redoing your retrieval logic.</p><p><strong>Structured output.</strong> Instead of parsing a wall of text out of the model’s response, you can map outputs directly to POJOs — genuinely useful when you’re feeding model output into the rest of a typed Java system.</p><p><strong>Observability.</strong> Because it’s a Spring project, it plugs into Micrometer, so you get metrics on latency, token usage, and errors the same way you’d instrument any other Spring service.</p><h3>A Word on Where It Stands Right Now</h3><p>Spring AI has moved fast. As of mid-2026, it’s on its 2.0 line, built on a Spring Boot 4 and Spring Framework 7 baseline, with Java 21 as the minimum runtime — which also means you get virtual threads for handling concurrent model calls without the usual thread-pool headaches. Spring AI 2.0 also folded in the full Model Context Protocol ecosystem, including the MCP Java SDK and the previously separate mcp-annotations module.</p><p>Worth being honest about: it’s still a moving API surface, and some areas — the Advisors API in particular, which handles things like chaining RAG retrieval with conversation memory — have documentation that’s thinner than you’d like. If your team leans on Spring AI for anything non-trivial, budget time to read the integration tests, not just the reference docs.</p><p>One thing that shouldn’t worry you: performance. The latency of a network round trip to an LLM dwarfs any overhead the framework itself adds, by a couple of orders of magnitude — so the abstraction layer isn’t the bottleneck people sometimes assume it is.</p><h3>Should You Use It?</h3><p>If your team already lives in the Spring ecosystem and you want AI features without spinning up a separate Python microservice or a new deployment pipeline, Spring AI is the natural choice. It’s not the only option — LangChain4j is a strong alternative if you need broader provider support or more advanced multi-agent patterns, and the two aren’t mutually exclusive; plenty of teams use both in the same codebase.</p><p>But if you want to add a chatbot, a RAG pipeline over internal docs, or a tool-calling agent directly inside an existing Spring Boot service — without learning a new language or a new mental model — Spring AI is worth your weekend.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2afc0169a195" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When ECharts Refused to Scroll: My Hacky but Beautiful Fix ️‍♂️]]></title>
            <link>https://medium.com/@shubhamsapkal.dev/when-echarts-refused-to-scroll-my-hacky-but-beautiful-fix-%EF%B8%8F-%EF%B8%8F-db2794911975?source=rss-6b6f6392a96f------2</link>
            <guid isPermaLink="false">https://medium.com/p/db2794911975</guid>
            <category><![CDATA[echarts-for-react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[e-charts]]></category>
            <category><![CDATA[scrolling]]></category>
            <dc:creator><![CDATA[Shubhamsapkal]]></dc:creator>
            <pubDate>Fri, 29 Aug 2025 12:43:54 GMT</pubDate>
            <atom:updated>2025-08-29T12:43:54.764Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve ever used <a href="https://echarts.apache.org/">Apache ECharts</a> with React, you know it’s a beast. You throw data at it, and it happily plots gorgeous charts.</p><p>But one day, I threw <em>too much data</em> at it. Like, <strong>“boss wants all plants, all vendors, all months”</strong> kind of data.</p><p>Instead of scrolling nicely, my chart <strong>shrunk itself to oblivion</strong>.</p><p>Labels? Gone.</p><p>Bars? Toothpick-sized.</p><p>Me? Crying in console.log.</p><h3>The Problem</h3><p>By default, ECharts tries to fit <em>all your data</em> into the chart’s visible width.</p><p>That means if you have 200+ bars, instead of scroll, you get… something that looks like a barcode scanner output. 🛒🔍</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*bEtA4Yq01UiaD5f4YPWQag.png" /></figure><h3>The Fix (Expandable Outer Div Trick) 🪄</h3><p>Instead of fighting with ECharts configs, I thought:</p><p><strong>“What if I just resize the chart width dynamically and let the parent div scroll?”</strong></p><p>That’s exactly what I did. And it works beautifully. 🎉</p><p>Here’s my actual React component (with Flowbite styling too):</p><pre>import EChartsReact from &quot;echarts-for-react&quot;;<br>import { Card } from &quot;flowbite-react&quot;;<br>import { useEffect, useRef, useState } from &quot;react&quot;;<br>import { graphSeries } from &#39;src/lib/constant&#39;</pre><pre>export const ScrollableChart = ({ chartData }) =&gt; {<br>  const [barchartWidth, setBarChartWidth] = useState(window.innerWidth);<br>  const [option, setOption] = useState({<br>    ...graphSeries,<br>  });</pre><pre>  const containerRef = useRef(null);</pre><pre>  const resizeWidth = (dataLength: any, barCount: any) =&gt; {<br>    const windowWidth = containerRef?.current?.offsetWidth ?? window.innerWidth;<br>    const paddingNMargin = window.innerWidth &gt; 1660 ? 200 : 100;</pre><pre>    const barchartWidth =<br>      (barCount * (windowWidth &gt; 2550 ? 40 : 40) + 60) * dataLength +<br>      paddingNMargin;</pre><pre>    setBarChartWidth(<br>      Math.max(barchartWidth + paddingNMargin + 100, windowWidth - 70)<br>    );<br>  };</pre><pre>  useEffect(() =&gt; {<br>    resizeWidth(chartData?.length, 1);</pre><pre>    setOption({<br>      ...option,<br>      xAxis: {<br>        ...option.xAxis,<br>        data: chartData?.map((item) =&gt; item?.name),<br>      },<br>      series: {<br>        data: chartData?.map((item) =&gt; item?.value),<br>        type: &quot;bar&quot;,<br>        showBackground: true,<br>        backgroundStyle: {<br>          color: &quot;rgba(180, 180, 180, 0.2)&quot;,<br>        },<br>      },<br>    });<br>  }, [chartData]);</pre><pre>  return (<br>    &lt;Card ref={containerRef} className=&quot;h-full w-full px-12&quot;&gt;<br>      &lt;h1&gt;Scrollable Chart&lt;/h1&gt;<br>      &lt;div className=&quot;h-full w-full p-4 overflow-scroll&quot;&gt;<br>        &lt;EChartsReact<br>          option={option}<br>          style={{ height: &quot;100%&quot;, width: `${barchartWidth}px` }}<br>        /&gt;<br>      &lt;/div&gt;<br>    &lt;/Card&gt;<br>  );<br>};</pre><h3>What’s Happening Here?</h3><ul><li>I calculate barchartWidth dynamically based on data length.</li><li>I give my chart a <strong>huge width</strong> (style={{ width: barchartWidth }}), so bars don’t shrink.</li><li>I wrap it inside a div with overflow-scroll.</li><li>Boom 💥 → <strong>Chart scrolls horizontally</strong> without losing readability.</li></ul><h3>Demo 🚀</h3><p>🔗 <strong>GitHub Repo</strong>: <a href="https://github.com/shubham-sapkal/react-echarts-scroll-fix">https://github.com/shubham-sapkal/react-echarts-scroll-fix</a></p><p>🔗 <strong>Live Demo</strong>: &lt;Coming Soon&gt;</p><h3>Why I Like This Approach</h3><ul><li>✅ No fiddling with dataZoom (though that works too).</li><li>✅ Keeps chart looking natural.</li><li>✅ Super fast fix when your boss says: <em>“This chart looks broken on big data.”</em></li><li>✅ Works for bar, line, and even custom charts.</li></ul><h3>Final Thoughts</h3><p>Sometimes the best solutions are not hidden in the library docs. Sometimes, you just need to… <strong>make the container bigger and let it scroll.</strong></p><p>So next time your ECharts goes full “barcode mode”, don’t panic.</p><p>Expand the outer div, enable scroll, and walk away like a hero. 🦸</p><p>✨ If this helped (or made you chuckle), clap a few times 👏 and share it with your teammates. May your charts stay scrollable and your bosses stay happy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db2794911975" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>