<?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 fullstackjavadev.in on Medium]]></title>
        <description><![CDATA[Stories by fullstackjavadev.in on Medium]]></description>
        <link>https://medium.com/@javafullstackdev?source=rss-5382eb60a9e4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*l6Ucj0Q8qOoviyhYbF40Jw.png</url>
            <title>Stories by fullstackjavadev.in on Medium</title>
            <link>https://medium.com/@javafullstackdev?source=rss-5382eb60a9e4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 13:03:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@javafullstackdev/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[gRPC-Spring-Boot-Starter: Authentication Methods]]></title>
            <link>https://javafullstackdev.medium.com/grpc-spring-boot-starter-authentication-methods-10e2f9fa068c?source=rss-5382eb60a9e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/10e2f9fa068c</guid>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[grpc-web]]></category>
            <category><![CDATA[grpc-gateway]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[fullstackjavadev.in]]></dc:creator>
            <pubDate>Sun, 04 May 2025 06:45:09 GMT</pubDate>
            <atom:updated>2025-05-04T06:45:09.206Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dsw5KyrSIiqqi2hKxenTNA.jpeg" /></figure><h3>Introduction</h3><p>The grpc-spring-boot-starter provides a seamless way to integrate gRPC services into Spring Boot applications. However, securing gRPC endpoints requires implementing authentication mechanisms. In this blog, we’ll explore different authentication strategies for gRPC with Spring Boot, including token-based authentication, TLS, and OAuth2.</p><h3>Why Secure gRPC Services?</h3><p>Since gRPC communicates over HTTP/2 and supports high-performance remote procedure calls, it is crucial to protect services from unauthorized access. Common threats include:</p><ul><li>Unauthorized access to sensitive data.</li><li>Man-in-the-middle attacks.</li><li>Service abuse due to unrestricted access.</li></ul><p>To prevent these issues, we can enforce authentication at the transport and application levels.</p><h3>Authentication Methods for gRPC in Spring Boot</h3><p>Here are some common authentication strategies for securing gRPC services:</p><h3>1. Basic Authentication with Metadata</h3><p>A simple way to authenticate gRPC requests is by passing credentials in the metadata.</p><h4>Server-side Implementation</h4><pre>@GrpcService<br>public class AuthenticatedService extends AuthServiceGrpc.AuthServiceImplBase {<br>    @Override<br>    public void secureMethod(HelloRequest request, StreamObserver&lt;HelloResponse&gt; responseObserver) {<br>        // Extract metadata from the request<br>        Context ctx = Context.current();<br>        String token = ctx.get(Metadata.Key.of(&quot;authorization&quot;, Metadata.ASCII_STRING_MARSHALLER));</pre><pre>        if (!&quot;valid-token&quot;.equals(token)) {<br>            responseObserver.onError(Status.UNAUTHENTICATED.withDescription(&quot;Invalid token&quot;).asRuntimeException());<br>            return;<br>        }</pre><pre>        HelloResponse response = HelloResponse.newBuilder().setMessage(&quot;Hello, authenticated user!&quot;).build();<br>        responseObserver.onNext(response);<br>        responseObserver.onCompleted();<br>    }<br>}</pre><h4>Client-side Implementation</h4><pre>ManagedChannel channel = ManagedChannelBuilder.forAddress(&quot;localhost&quot;, 9090).usePlaintext().build();</pre><pre>Metadata metadata = new Metadata();<br>metadata.put(Metadata.Key.of(&quot;authorization&quot;, Metadata.ASCII_STRING_MARSHALLER), &quot;valid-token&quot;);</pre><pre>AuthServiceGrpc.AuthServiceBlockingStub stub = AuthServiceGrpc.newBlockingStub(channel)<br>        .withCallCredentials(new MetadataUtils(metadata));</pre><pre>HelloRequest request = HelloRequest.newBuilder().setName(&quot;John&quot;).build();<br>HelloResponse response = stub.secureMethod(request);<br>System.out.println(response.getMessage());</pre><h3>2. Secure gRPC with TLS</h3><p>Transport Layer Security (TLS) encrypts communication between the client and server, preventing data interception.</p><h4>Configuring TLS in Spring Boot gRPC Server</h4><p>In application.yml:</p><pre>grpc:<br>  server:<br>    security:<br>      enabled: true<br>      certificate-chain: classpath:certs/server-cert.pem<br>      private-key: classpath:certs/server-key.pem</pre><p>This ensures that all incoming gRPC requests must be encrypted.</p><h4>Configuring TLS in gRPC Client</h4><pre>ManagedChannel channel = ManagedChannelBuilder<br>        .forAddress(&quot;localhost&quot;, 9090)<br>        .useTransportSecurity()<br>        .build();</pre><p>With this setup, only TLS-secured connections are allowed.</p><h3>3. OAuth2 Authentication with JWT</h3><p>For enterprise-grade security, gRPC can leverage OAuth2 and JWTs to authenticate requests.</p><h4>Server-side Configuration</h4><pre>@GrpcService<br>public class JwtAuthenticatedService extends AuthServiceGrpc.AuthServiceImplBase {<br>    @Override<br>    public void secureMethod(HelloRequest request, StreamObserver&lt;HelloResponse&gt; responseObserver) {<br>        try {<br>            String jwt = extractJwtFromMetadata();<br>            DecodedJWT decodedJWT = JWT.require(Algorithm.HMAC256(&quot;secret-key&quot;))<br>                                      .build()<br>                                      .verify(jwt);<br>            <br>            HelloResponse response = HelloResponse.newBuilder().setMessage(&quot;Welcome &quot; + decodedJWT.getSubject()).build();<br>            responseObserver.onNext(response);<br>            responseObserver.onCompleted();<br>        } catch (JWTVerificationException e) {<br>            responseObserver.onError(Status.UNAUTHENTICATED.withDescription(&quot;Invalid JWT&quot;).asRuntimeException());<br>        }<br>    }<br>}</pre><h4>Client-side Implementation</h4><pre>String jwtToken = generateJwtToken();<br>Metadata metadata = new Metadata();<br>metadata.put(Metadata.Key.of(&quot;authorization&quot;, Metadata.ASCII_STRING_MARSHALLER), &quot;Bearer &quot; + jwtToken);</pre><p>With this setup, only valid JWTs are accepted for authentication.</p><h3>Conclusion</h3><p>gRPC services in Spring Boot can be secured using various authentication mechanisms, such as metadata-based authentication, TLS encryption, and OAuth2 with JWT. Depending on the security requirements, you can choose the method that best suits your needs.</p><p>Would you like a deep dive into implementing role-based access control (RBAC) for gRPC? Let me know in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10e2f9fa068c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ How to Build a Complex Spring Boot Backend (So You Stop Being Jobless)]]></title>
            <link>https://javafullstackdev.medium.com/how-to-build-a-complex-spring-boot-backend-so-you-stop-being-jobless-be71fc3c2c3c?source=rss-5382eb60a9e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/be71fc3c2c3c</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[job-interview]]></category>
            <category><![CDATA[java8]]></category>
            <category><![CDATA[job-hunting]]></category>
            <dc:creator><![CDATA[fullstackjavadev.in]]></dc:creator>
            <pubDate>Sun, 04 May 2025 06:41:39 GMT</pubDate>
            <atom:updated>2025-05-04T06:41:39.775Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i-RNPmfeAVEVzpP6ZRWQJA.png" /></figure><p>So you’ve spent months polishing your resume, applying to every “Java Backend Engineer” job on LinkedIn, and still… crickets. Maybe it’s time to face the truth: <strong>your Spring Boot project is just another to-do list API</strong>. Let’s fix that, shall we?</p><p>This blog is your brutally honest roadmap to build a <strong>real</strong>, <strong>complex</strong>, <strong>production-worthy backend project</strong> using Spring Boot. Not a tutorial for kids. This one’s for future CTOs.</p><h3>🚀 Phase 1: Spring Boot Fundamentals (Yes, Actually Learn It This Time)</h3><p>Before you dream about microservices and Kubernetes, at least understand what @RestController does without Googling it every time.</p><h3>✅ What You Need to Know</h3><ul><li>REST APIs using @RestController, DTOs, request validation</li><li>Dependency Injection (yes, @Autowired isn’t magic)</li><li>YAML configs and multiple profiles like dev, prod (if you’re still hardcoding URLs, we need to talk)</li><li>Maven or Gradle — pick one and stop crying</li></ul><p>🛠 <strong>Tools</strong>: Postman, Spring Boot DevTools, and enough caffeine to replace your social life.</p><h3>🛠️ Phase 2: Talk to the Damn Database</h3><p>Your app doesn’t need to store data in a List forever. Get serious.</p><h3>✅ Learn JPA + Hibernate</h3><ul><li>Relationships: @OneToMany, not one-to-regret</li><li>JPQL for complex queries (SQL is not a dirty word)</li><li>Pagination with Pageable, not findAll()</li><li>DTO mapping for sanity</li></ul><p>🧠 Bonus: Use Flyway or Liquibase. Stop manually altering tables like it’s 2010.</p><h3>🔐 Phase 3: Stop Building Insecure Toy Apps</h3><p>If your API exposes everything to everyone, congrats — you’re building a hacker’s dream.</p><h3>✅ Security You Can’t Ignore</h3><ul><li>JWT-based Authentication/Authorization</li><li>Role-Based Access Control (RBAC)</li><li>CSRF protection, CORS config</li><li>Optional Flex: OAuth2 with Google, GitHub, or Keycloak</li></ul><p>Pro tip: Don’t leave /admin open just to test it. Recruiters will test your GitHub and silently judge you.</p><h3>📦 Phase 4: Write Real Business Logic</h3><p>Your service layer should do more than just “return repo.findAll()”.</p><h3>✅ Business Layer Like a Pro</h3><ul><li>@Service classes handle real-world logic</li><li>Centralized error handling with @ControllerAdvice</li><li>Input validation using @Valid, not if(name==null)</li><li>Apply some DDD (no, it’s not a disease)</li></ul><h3>🧪 Phase 5: Tests — The Adulting Part</h3><p>If your excuse is “it works on my machine,” you’re not ready.</p><h3>✅ Test Everything</h3><ul><li>JUnit + Mockito for unit tests</li><li>Testcontainers for real DBs in tests</li><li>WebTestClient or MockMvc for controller tests</li><li>WireMock to mock those flaky external APIs</li></ul><p>Let your tests fail before your interviews do.</p><h3>📡 Phase 6: Talk to Other Services (Without Crying)</h3><p>Your app needs to interact with others — don’t be socially awkward like your LinkedIn headline.</p><p>connect with me — on <a href="https://www.linkedin.com/in/nikhil-sahoo/">linkedin</a></p><h3>✅ WebClient &amp; Resilience</h3><ul><li>Use non-blocking WebClient</li><li>Retry logic, timeouts, circuit breakers with Resilience4j</li><li>Handle failures like a champ, not with Thread.sleep(5000)</li></ul><h3>⚙️ Phase 7: Be Asynchronous (Like That One Guy Who Never Replies)</h3><h3>✅ Messaging Queues</h3><ul><li>Kafka or RabbitMQ for async processing</li><li>Spring Cloud Stream makes life easy</li><li>Dead Letter Queues (because things <em>will</em> fail)</li></ul><p>If you’re still using @Async, it’s time to grow up.</p><h3>⛓️ Phase 8: Microservices (The Real Kind)</h3><p>Not “I have 3 controllers in 3 folders” microservices — the actual distributed system kind.</p><h3>✅ Microservice Communication</h3><ul><li>Feign clients, WebClient, Eureka</li><li>Centralized config with Spring Cloud Config</li><li>Load balancing, service discovery</li></ul><p>Just don’t forget: monoliths aren’t evil if you don’t understand microservices yet.</p><h3>📂 Phase 9: Modular Architecture (No More God Class)</h3><p>Split your app into:</p><ul><li>auth-service</li><li>document-service</li><li>billing-service</li><li>notification-service</li></ul><p>Use Maven multi-modules or Gradle composite builds. Your future teammates will thank you — if you ever get a job.</p><h3>☁️ Phase 10: Deploy Like a Legend</h3><p>You want to work at a tech company but can’t Dockerize your app? Come on.</p><h3>✅ DevOps Stuff</h3><ul><li>Docker multi-stage builds</li><li>Docker Compose for local setup</li><li>Kubernetes for the real world (Minikube to start)</li><li>Helm charts if you’re serious</li></ul><h3>✅ Observability</h3><ul><li>Logs with Logback (JSON format, pls)</li><li>Metrics with Micrometer + Prometheus</li><li>Tracing with OpenTelemetry + Jaeger</li><li>Spring Boot Actuator for health checks</li></ul><h3>💡 Project Idea: Build Something That Screams “Hire Me”</h3><h3>🔥 AI-Powered Legal Document SaaS</h3><ul><li>PDF upload and parsing</li><li>JWT + Keycloak auth</li><li>OpenAI integration for summarization</li><li>Kafka for async</li><li>Stripe for billing</li><li>Spring Boot Admin dashboard</li><li>Microservices + Docker + K8s</li></ul><p>Now <em>that</em> is a portfolio project. Not another “BookStore API with CRUD.”</p><h3>🧠 Still Jobless?</h3><p>Listen. If you’re:</p><ul><li>Doing copy-paste Stack Overflow development</li><li>Building CRUD apps since 2021</li><li>Thinking “microservices” means multiple classes</li></ul><p>Then yes, you’re still jobless — and you’ll stay that way unless you <strong>level up</strong>.</p><p>connect with me — on <a href="https://www.linkedin.com/in/nikhil-sahoo/">linkedin</a></p><h3>💪 Final Words: You Got This</h3><p>Building a complex Spring Boot project isn’t easy — but neither is sitting jobless, pretending you’re “waiting for the right opportunity.”</p><p>📢 Get off your lazy backend, open IntelliJ, and <strong>build something that scares you</strong>. When you’re done, deploy it, document it, open-source it.</p><p>And then? Watch those recruiters slide into your inbox like:</p><blockquote><em>“Hi, loved your project. Are you open to opportunities?”</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be71fc3c2c3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Better Java Code: Linters, Mutation Testing, and Smarter Code Coverage]]></title>
            <link>https://javafullstackdev.medium.com/build-better-java-code-linters-mutation-testing-and-smarter-code-coverage-f293ae5fda3a?source=rss-5382eb60a9e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/f293ae5fda3a</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[testing-tools]]></category>
            <category><![CDATA[sonarqube]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[mockito]]></category>
            <dc:creator><![CDATA[fullstackjavadev.in]]></dc:creator>
            <pubDate>Thu, 10 Apr 2025 13:07:33 GMT</pubDate>
            <atom:updated>2025-04-12T10:31:04.274Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5naRgjdZCKzeA4Mm" /><figcaption>Photo by <a href="https://unsplash.com/@austindistel?utm_source=medium&amp;utm_medium=referral">Austin Distel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When writing maintainable, robust Java code, unit tests are just the beginning. To truly raise the bar, engineering teams need to <em>analyze</em> their code, not just test it. In this blog, we’ll dive into three vital components of a modern Java project’s quality toolchain:</p><ol><li><strong>Linters (with a focus on Sonar)</strong></li><li><strong>Mutation Testing using PITest</strong></li><li><strong>Mastering Code Coverage — and why 100% coverage isn’t the holy grail</strong></li></ol><h3>✅ 1. Use a Linter — Sonar is a Solid Standard</h3><p>A <strong>linter</strong> is like a no-nonsense teammate who’s never afraid to tell you your code smells.</p><p><strong>Why it matters:</strong> Linters enforce coding standards, highlight potential bugs, and suggest improvements. While IDEs like IntelliJ do a decent job of catching basic issues, linters bring consistency across teams and CI pipelines.</p><p><strong>Why Sonar stands out:</strong></p><ul><li><strong>SonarQube / SonarCloud</strong> integrates directly with your build pipeline.</li><li>It flags:</li><li>Code smells</li><li>Vulnerabilities</li><li>Bugs</li><li>Code duplications</li><li>Provides a <strong>“Quality Gate”</strong> — a set of pass/fail conditions your code must meet before being merged.</li></ul><h3>Pro Tip:</h3><p>Set up SonarCloud with GitHub Actions or GitLab CI to scan every PR. No code merges without passing the quality gate. It’s annoying — but it keeps your codebase clean.</p><p><a href="https://codewithnik.gumroad.com/l/java-interview-prep">https://codewithnik.gumroad.com/l/java-interview-prep</a></p><h3>🧪 2. Add Mutation Testing via PITest</h3><p><strong>“My code has 100% test coverage!”</strong></p><p>Cool. But are your tests actually <em>good</em>?</p><p>Enter <strong>mutation testing</strong>, a brutal yet beautiful way to measure how sensitive your tests are to change.</p><h3>What is Mutation Testing?</h3><p>Mutation testing works by making small modifications (mutations) to your code — like changing == to !=, or flipping true to false—and checking if your tests fail.</p><p>If they don’t, your tests <strong>missed a bug</strong>. That’s a red flag.</p><h3>Why PITest?</h3><p><a href="https://pitest.org/">PITest</a> is the most popular mutation testing tool for Java.</p><p><strong>Features:</strong></p><ul><li>Integrates with Maven, Gradle, and JUnit.</li><li>Highly configurable — target specific packages or classes.</li><li>Generates HTML reports with visual mutation results.</li></ul><h3>Real-World Example:</h3><pre>public boolean isAdult(int age) {<br>    return age &gt;= 18;<br>}</pre><p>PITest may change this to:</p><pre>return age &gt; 18;</pre><p>If your test doesn’t catch this subtle change, it’s not robust enough.</p><blockquote><em>🧠 </em><strong><em>Mutation Score = Killed Mutants / Total Mutants</em></strong><em><br>Aim for 70–80% and improve from there.</em></blockquote><h3>📈 3. Understand Your Code Coverage Tool (And Stop Worshiping 100%)</h3><p><strong>Code coverage</strong> tells you what percentage of your codebase is being exercised by tests.</p><p>Most Java projects use:</p><ul><li><strong>JaCoCo</strong> (via Maven or Gradle)</li><li><strong>SonarQube</strong> (reads JaCoCo reports)</li><li><strong>IntelliJ coverage tools</strong></li></ul><h3>But here’s the kicker:</h3><blockquote><strong><em>100% coverage ≠ 100% tested</em></strong></blockquote><p>Why?</p><ul><li>Not all code <em>needs</em> to be tested.</li><li>Not all code <em>can</em> be meaningfully tested.</li></ul><h3>Example: Configuration and Boilerplate Code</h3><p>Let’s say you have a Spring Boot AppConfig class:</p><pre>@Configuration<br>public class AppConfig {<br>    @Bean<br>    public RestTemplate restTemplate() {<br>        return new RestTemplate();<br>    }<br>}</pre><p>Should you write a test just to call restTemplate() and bump coverage? Nope.</p><h3>Solution:</h3><p><strong>Sequester untestable or unnecessary code into separate packages</strong>, and <strong>exclude those packages from coverage reports</strong> using configuration in jacoco.gradle or pom.xml.</p><h4>JaCoCo Exclusion Example (Maven):</h4><pre>&lt;excludes&gt;<br>    &lt;exclude&gt;**/config/**&lt;/exclude&gt;<br>    &lt;exclude&gt;**/dto/**&lt;/exclude&gt;<br>&lt;/excludes&gt;</pre><p>That way, your 100% coverage target only applies to logic that <em>should</em> be tested.</p><h3>🛠️ How to Set It All Up Together</h3><h3>For Maven Projects:</h3><ul><li><strong>Sonar</strong>: Add sonar-maven-plugin, connect to SonarQube/SonarCloud.</li><li><strong>PITest</strong>: Use the pitest-maven plugin.</li><li><strong>JaCoCo</strong>: Enable with jacoco-maven-plugin.</li></ul><p>Integrate them into your pipeline like this:</p><pre># GitHub Actions sample<br>jobs:<br>  build:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - uses: actions/checkout@v3<br>      - name: Build and Test<br>        run: mvn clean verify<br>      - name: Run Sonar<br>        run: mvn sonar:sonar<br>      - name: Run Mutation Tests<br>        run: mvn org.pitest:pitest-maven:mutationCoverage</pre><h3>💡 Final Thoughts</h3><ul><li><strong>Lint</strong> to catch bad patterns.</li><li><strong>Mutate</strong> to find weak tests.</li><li><strong>Cover wisely</strong>, not obsessively.</li></ul><p>Together, these practices create a robust quality gate around your codebase, giving you and your team confidence to refactor, ship, and scale faster.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f293ae5fda3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot OAuth2 Client: Preventing Startup Failures When OAuth Host is Unreachable]]></title>
            <link>https://javafullstackdev.medium.com/spring-boot-oauth2-client-preventing-startup-failures-when-oauth-host-is-unreachable-01cf6804989d?source=rss-5382eb60a9e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/01cf6804989d</guid>
            <category><![CDATA[spring-security]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[fullstackjavadev.in]]></dc:creator>
            <pubDate>Wed, 02 Apr 2025 20:09:48 GMT</pubDate>
            <atom:updated>2025-04-02T20:09:51.754Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BVpY2R1Z3HDlFMGopDqo2g.jpeg" /></figure><p>Spring Boot’s spring-boot-starter-oauth2-client is widely used to implement OAuth2 authentication in microservices. However, one common issue developers face is that their application fails to start if the OAuth host (identity provider) is unreachable. This can be frustrating, especially in environments where external services might be temporarily unavailable.</p><p>In this blog, we’ll explore why this happens, how it affects your application, and most importantly, how to prevent it while maintaining secure authentication.</p><h3>The Problem</h3><p>When using spring-boot-starter-oauth2-client, Spring Boot attempts to fetch the OAuth2 provider’s metadata (discovery document) at startup. If the OAuth server is down or unreachable, the application throws an exception and fails to start.</p><h3>Example Error</h3><pre>java.net.UnknownHostException: authorization-server.com<br>    at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:220)<br>    ...<br>Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for &quot;https://authorization-server.com/.well-known/openid-configuration&quot;</pre><p>This issue is particularly problematic in CI/CD pipelines, local development, or when deploying to cloud environments where network instability is common.</p><h3>Why Does This Happen?</h3><p>Spring Boot’s spring-security-oauth2-client automatically tries to fetch the issuer’s metadata during startup by default. The metadata endpoint (e.g., <a href="https://authorization-server.com/.well-known/openid-configuration">https://authorization-server.com/.well-known/openid-configuration</a>) provides details like authorization and token endpoints, scopes, and supported authentication methods.</p><p>If the server is unreachable, the application does not have enough information to proceed, leading to a startup failure.</p><h3>Solution: Lazy Initialization of OAuth2 Client</h3><p>To prevent startup failures, we can configure Spring Boot to lazily initialize the OAuth2 client. This ensures that the application starts even if the OAuth server is down, and it only attempts metadata retrieval when authentication is actually needed.</p><h3>1. Disable Auto-Configuration for OAuth2 Client</h3><p>One way to defer metadata retrieval is to disable the default spring-security-oauth2-client auto-configuration.</p><pre>spring.security.oauth2.client.provider.myprovider.issuer-uri=optional://authorization-server.com</pre><p>Setting an invalid or optional URI prevents Spring from making an HTTP request at startup.</p><h3>2. Use Static Configuration Instead of Discovery</h3><p>Instead of relying on Spring Boot to fetch OAuth2 metadata dynamically, manually configure the OAuth2 endpoints in application.yml:</p><pre>spring:<br>  security:<br>    oauth2:<br>      client:<br>        registration:<br>          myclient:<br>            client-id: my-client-id<br>            client-secret: my-secret<br>            authorization-grant-type: authorization_code<br>            redirect-uri: &quot;{baseUrl}/login/oauth2/code/{registrationId}&quot;<br>        provider:<br>          myprovider:<br>            authorization-uri: https://authorization-server.com/oauth/authorize<br>            token-uri: https://authorization-server.com/oauth/token<br>            user-info-uri: https://authorization-server.com/userinfo<br>            jwk-set-uri: https://authorization-server.com/oauth/jwks</pre><p>This approach ensures that Spring Boot doesn’t need to call the OAuth server at startup.</p><h3>3. Enable Lazy Initialization</h3><p>Another approach is to configure lazy initialization for Spring Security beans. This allows the application to start without immediately initializing OAuth2 clients.</p><p>Add this in <a href="http://application.properties/">application.properties</a>:</p><pre>spring.main.lazy-initialization=true</pre><p>Or configure it in SpringBootApplication:</p><pre>@SpringBootApplication<br>public class MyApplication {<br>    public static void main(String[] args) {<br>        SpringApplication app = new SpringApplication(MyApplication.class);<br>        app.setLazyInitialization(true);<br>        app.run(args);<br>    }<br>}</pre><h3>4. Custom Exception Handling for OAuth Failures</h3><p>You can wrap your OAuth client calls in a try-catch block to handle failures gracefully at runtime:</p><pre>@Bean<br>public OAuth2AuthorizedClientManager authorizedClientManager(<br>        ClientRegistrationRepository clientRegistrationRepository,<br>        OAuth2AuthorizedClientService authorizedClientService) <br><br>{<br>DefaultOAuth2AuthorizedClientManager manager =<br>            new DefaultOAuth2AuthorizedClientManager(<br>                    clientRegistrationRepository, authorizedClientService);<br>    manager.setAuthorizedClientProvider(clientProvider -&gt; {<br>        try {<br>            // Custom logic to handle failures<br>            return clientProvider.authorize(null);<br>        } catch (Exception e) {<br>            System.out.println(&quot;OAuth2 Client Initialization Failed: &quot; + e.getMessage());<br>            return null; // Handle failure gracefully<br>        }<br>    });<br>    return manager;<br>}</pre><h3>Conclusion</h3><p>Spring Boot’s default behavior of fetching OAuth2 metadata at startup can cause failures if the OAuth host is unreachable. However, by implementing lazy initialization, using static configurations, and handling errors properly, you can ensure that your application starts reliably in all environments.</p><p>Would you like more insights on Spring Security and OAuth2? Drop a comment below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01cf6804989d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Maximizing Earnings on Medium: A Guide for Writers with 6,000 Monthly Views]]></title>
            <link>https://javafullstackdev.medium.com/maximizing-earnings-on-medium-a-guide-for-writers-with-6-000-monthly-views-47b4d638fe3b?source=rss-5382eb60a9e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/47b4d638fe3b</guid>
            <category><![CDATA[blogging]]></category>
            <category><![CDATA[online-money]]></category>
            <category><![CDATA[wifi-monetization]]></category>
            <dc:creator><![CDATA[fullstackjavadev.in]]></dc:creator>
            <pubDate>Tue, 27 Aug 2024 15:24:40 GMT</pubDate>
            <atom:updated>2024-08-27T15:24:40.401Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b087X7onVS5u1QNW" /><figcaption>Photo by <a href="https://unsplash.com/@kaitlynbaker?utm_source=medium&amp;utm_medium=referral">Kaitlyn Baker</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Introduction</strong></p><p>Are you wondering how much you can earn from <a href="http://medium.com/">Medium.com</a> with around 6,000 views on your blog posts? With the Medium Partner Program, the potential to earn a steady income is within reach, especially if you know how to maximize engagement and attract Medium’s paying members. In this blog, we’ll break down how Medium’s payment system works, how much you can realistically earn with 6,000 views per month, and tips to increase your earnings.</p><p><strong>Understanding Medium’s Payment Structure</strong></p><p>Medium compensates writers based on the time paying members spend reading their articles. Unlike traditional ad-based revenue models, Medium focuses on reader engagement. This means that your earnings aren’t just about how many people click on your article but how much time they spend engaging with your content.</p><p><strong>1. Earnings Per 1,000 Views</strong></p><p>Generally, writers on Medium report earning between $5 to $15 per 1,000 views. This range can vary widely depending on several factors, including:</p><ul><li><strong>Reader Engagement</strong>: Articles that capture the reader’s attention and encourage them to read to the end tend to earn more. Engagement metrics like reading time and claps are crucial.</li><li><strong>Medium Members</strong>: Your earnings are directly linked to how many Medium members read your articles. Since the platform pays based on member reading time, attracting these readers is key.</li></ul><p><strong>2. Engagement is Key</strong></p><p>It’s important to note that Medium emphasizes engagement over sheer view count. If your 6,000 views per month come from highly engaged readers, you could be on the higher end of the earnings spectrum. Engagement includes:</p><ul><li><strong>Reading Time</strong>: The longer readers stay on your article, the more you earn.</li><li><strong>Claps and Responses</strong>: These are indicators of how much readers enjoyed your content, and they can boost your visibility on the platform, leading to more views and, consequently, more earnings.</li></ul><p><strong>3. The Role of Medium Members</strong></p><p>Medium’s payment system favors views from paying Medium members. If most of your readers are subscribers who spend significant time on your articles, your earnings will be higher. Conversely, if a majority of your views come from non-members, you might see lower earnings.</p><p><strong>4. Bonus Opportunities</strong></p><p>Occasionally, Medium offers bonuses to writers whose content performs exceptionally well or aligns with specific initiatives. This can be an additional income stream if your content consistently attracts high engagement.</p><p><strong>Estimating Your Earnings with 6,000 Monthly Views</strong></p><p>Given the average earnings per 1,000 views, here’s a rough estimate of what you can expect:</p><ul><li><strong>Low Range</strong>: At $5 per 1,000 views, 6,000 views could earn you about $30 per month.</li><li><strong>High Range</strong>: At $15 per 1,000 views, 6,000 views could earn you up to $90 per month.</li></ul><p>These figures are estimates. Actual earnings can vary based on the factors we’ve discussed, such as engagement and the proportion of your readership that consists of paying members.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xzhzPZ1dJZiNOtnd" /><figcaption>Photo by <a href="https://unsplash.com/@sharonmccutcheon?utm_source=medium&amp;utm_medium=referral">Alexander Grey</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Tips to Maximize Your Earnings on Medium</strong></p><ol><li><strong>Focus on Quality</strong>: High-quality, well-researched articles that provide value to readers are more likely to engage them. Make sure your content is compelling, informative, and well-structured.</li><li><strong>Choose Topics Wisely</strong>: Writing about trending topics or issues that are highly relevant to your target audience can drive more views. Use tools like Google Trends or Medium’s own search to find topics with high reader interest.</li><li><strong>Consistency is Key</strong>: Regularly publishing new content helps build a loyal readership. Consistency can keep your current readers engaged and attract new ones.</li><li><strong>Promote Your Articles</strong>: Share your Medium articles across your social media channels, LinkedIn, and other platforms. Cross-promotion can increase your article’s visibility and drive more views.</li><li><strong>Engage with Your Readers</strong>: Respond to comments on your articles and engage with readers. Building a community around your content can lead to more loyal readers and higher engagement rates.</li></ol><p><strong>Conclusion</strong></p><p>Earning money on Medium is about more than just view count; it’s about engaging your readers and keeping them on your page. With 6,000 views per month, you have a solid foundation to start earning. By focusing on quality, understanding Medium’s payment system, and optimizing for engagement, you can maximize your earnings and make the most out of your writing on Medium.</p><p><strong>Call to Action</strong></p><p>Are you already writing on Medium or thinking about starting? Share your experiences and tips in the comments below. If you found this guide helpful, don’t forget to clap and share it with your fellow writers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47b4d638fe3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Boot SSL Hot Reload on Kubernetes: A Detailed Guide]]></title>
            <link>https://javafullstackdev.medium.com/spring-boot-ssl-hot-reload-on-kubernetes-a-detailed-guide-a592ebce269f?source=rss-5382eb60a9e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a592ebce269f</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[fullstackjavadev.in]]></dc:creator>
            <pubDate>Fri, 02 Aug 2024 17:16:47 GMT</pubDate>
            <atom:updated>2025-04-12T10:38:09.508Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C4xtHw6TFmfhZNN4" /><figcaption>Photo by <a href="https://unsplash.com/@ngeshlew?utm_source=medium&amp;utm_medium=referral">Lewis Kang&#39;ethe Ngugi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In modern applications, security is paramount, and SSL/TLS ensures secure communication between clients and servers. Spring Boot makes it easy to enable SSL, but managing SSL certificates, especially when they need to be updated, can be challenging. In a Kubernetes environment, achieving SSL hot reload — updating certificates without downtime — is crucial for maintaining a secure and highly available application. This blog will guide you through enabling SSL hot reload for a Spring Boot application running on Kubernetes.</p><p><a href="https://www.facebook.com/share/g/xrcV8ja5WTHW52z5/">Log in or sign up to view</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y-u5mXnH11f0KINYeePWUw.jpeg" /></figure><p><a href="https://codewithnik.gumroad.com/l/java-interview-prep">https://codewithnik.gumroad.com/l/java-interview-prep</a></p><h3>Table of Contents</h3><ol><li><a href="#introduction">Introduction</a></li><li><a href="#prerequisites">Prerequisites</a></li><li><a href="#setting-up-a-spring-boot-application">Setting Up a Spring Boot Application</a></li><li><a href="#enabling-ssl-in-spring-boot">Enabling SSL in Spring Boot</a></li><li><a href="#configuring-kubernetes-secrets">Configuring Kubernetes Secrets</a></li><li><a href="#mounting-secrets-as-volumes">Mounting Secrets as Volumes</a></li><li><a href="#implementing-ssl-hot-reload">Implementing SSL Hot Reload</a></li><li><a href="#deploying-to-kubernetes">Deploying to Kubernetes</a></li><li><a href="#testing-ssl-hot-reload">Testing SSL Hot Reload</a></li><li><a href="#conclusion">Conclusion</a></li></ol><h3>Introduction</h3><p>SSL/TLS certificates have expiration dates and need periodic renewal. Traditionally, updating these certificates requires a restart of the application, causing potential downtime. In a microservices architecture deployed on Kubernetes, this downtime can disrupt service availability. Implementing SSL hot reload ensures that your Spring Boot application seamlessly updates its certificates without restarts, maintaining continuous secure communication.</p><h3>Prerequisites</h3><p>Before you start, ensure you have the following:</p><ul><li>A Kubernetes cluster set up (Minikube, EKS, GKE, etc.)</li><li>kubectl configured to interact with your cluster</li><li>Docker installed and configured</li><li>A basic understanding of Spring Boot and Kubernetes</li><li>OpenSSL for generating SSL certificates</li></ul><h3>Setting Up a Spring Boot Application</h3><p>First, create a simple Spring Boot application. If you already have one, you can skip this section.</p><h3>1. Initialize a Spring Boot Project</h3><p>You can use Spring Initializr to generate a new project or set it up manually. For simplicity, we’ll use Spring Initializr.</p><pre>curl https://start.spring.io/starter.zip \<br>  -d dependencies=web \<br>  -d name=ssl-hot-reload-demo \<br>  -d artifactId=ssl-hot-reload-demo \<br>  -d packageName=com.example.sslhotreloaddemo \<br>  -d javaVersion=11 \<br>  -o ssl-hot-reload-demo.zip<br>unzip ssl-hot-reload-demo.zip<br>cd ssl-hot-reload-demo</pre><h3>2. Create a Simple REST Controller</h3><p>Create a simple REST controller to verify SSL functionality.</p><pre>package com.example.sslhotreloaddemo;<br>import org.springframework.web.bind.annotation.GetMapping;<br>import org.springframework.web.bind.annotation.RestController;<br>@RestController<br>public class HelloController {<br>    @GetMapping(&quot;/hello&quot;)<br>    public String hello() {<br>        return &quot;Hello, secure world!&quot;;<br>    }<br>}</pre><h3>Enabling SSL in Spring Boot</h3><p>Next, configure Spring Boot to use SSL.</p><h3>1. Generate SSL Certificates</h3><p>Generate a self-signed certificate using OpenSSL for testing purposes.</p><pre>mkdir -p src/main/resources/keystore<br>openssl req -x509 -newkey rsa:4096 -keyout src/main/resources/keystore/private.key -out src/main/resources/keystore/public.crt -days 365 -nodes -subj &quot;/CN=localhost&quot;<br>openssl pkcs12 -export -in src/main/resources/keystore/public.crt -inkey src/main/resources/keystore/private.key -out src/main/resources/keystore/keystore.p12 -name &quot;ssl-hot-reload&quot; -passout pass:password</pre><h3>2. Configure SSL in <a href="http://application.properties/">application.properties</a></h3><p>Update src/main/resources/<a href="http://application.properties/">application.properties</a> with the following configuration:</p><pre>server.port=8443<br>server.ssl.key-store=classpath:keystore/keystore.p12<br>server.ssl.key-store-password=password<br>server.ssl.key-store-type=PKCS12<br>server.ssl.key-alias=ssl-hot-reload</pre><h3>Configuring Kubernetes Secrets</h3><p>Store the SSL certificates as Kubernetes secrets.</p><pre>kubectl create secret generic ssl-certs --from-file=src/main/resources/keystore/keystore.p12</pre><h3>Mounting Secrets as Volumes</h3><p>Modify the Kubernetes deployment manifest to mount the secret as a volume.</p><h3>1. Create a Deployment Manifest</h3><p>Create deployment.yaml with the following content:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: ssl-hot-reload-demo<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: ssl-hot-reload-demo<br>  template:<br>    metadata:<br>      labels:<br>        app: ssl-hot-reload-demo<br>    spec:<br>      containers:<br>      - name: ssl-hot-reload-demo<br>        image: ssl-hot-reload-demo:latest<br>        ports:<br>        - containerPort: 8443<br>        volumeMounts:<br>        - name: ssl-certs<br>          mountPath: /etc/ssl/certs<br>          readOnly: true<br>      volumes:<br>      - name: ssl-certs<br>        secret:<br>          secretName: ssl-certs</pre><h3>Implementing SSL Hot Reload</h3><p>To enable SSL hot reload, we’ll leverage Spring Cloud’s Config Watcher and Actuator to trigger a reload.</p><h3>1. Add Dependencies</h3><p>Add the necessary dependencies in pom.xml:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-cloud-starter&lt;/artifactId&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-cloud-starter-kubernetes-fabric8&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><h3>2. Create a Configuration Watcher</h3><p>Implement a configuration watcher to detect changes in the mounted volume.</p><pre>package com.example.sslhotreloaddemo;<br>import org.springframework.beans.factory.annotation.Value;<br>import org.springframework.cloud.context.restart.RestartEndpoint;<br>import org.springframework.scheduling.annotation.Scheduled;<br>import org.springframework.stereotype.Component;<br>import java.nio.file.Files;<br>import java.nio.file.Path;<br>import java.nio.file.Paths;<br>@Component<br>public class SslConfigWatcher {<br>    @Value(&quot;${server.ssl.key-store}&quot;)<br>    private String keyStorePath;<br>    private long lastModifiedTime;<br>    private final RestartEndpoint restartEndpoint;<br>    public SslConfigWatcher(RestartEndpoint restartEndpoint) {<br>        this.restartEndpoint = restartEndpoint;<br>        this.lastModifiedTime = getLastModifiedTime();<br>    }<br>    @Scheduled(fixedRate = 10000)<br>    public void checkForChanges() {<br>        long currentModifiedTime = getLastModifiedTime();<br>        if (currentModifiedTime != lastModifiedTime) {<br>            lastModifiedTime = currentModifiedTime;<br>            restartEndpoint.restart();<br>        }<br>    }<br>    private long getLastModifiedTime() {<br>        try {<br>            Path path = Paths.get(keyStorePath.replace(&quot;classpath:&quot;, &quot;&quot;));<br>            return Files.getLastModifiedTime(path).toMillis();<br>        } catch (Exception e) {<br>            throw new RuntimeException(&quot;Failed to get the last modified time&quot;, e);<br>        }<br>    }<br>}</pre><h3>3. Enable Scheduling</h3><p>Enable scheduling in your main application class:</p><pre>package com.example.sslhotreloaddemo;<br>import org.springframework.boot.SpringApplication;<br>import org.springframework.boot.autoconfigure.SpringBootApplication;<br>import org.springframework.scheduling.annotation.EnableScheduling;<br>@SpringBootApplication<br>@EnableScheduling<br>public class EmployeeManagementApplication {<br>    public static void main(String[] args) {<br>        SpringApplication.run(EmployeeManagementApplication.class, args);<br>    }<br>}</pre><h3>Deploying to Kubernetes</h3><p>Build and push your Docker image, then deploy the application.</p><h3>1. Build Docker Image</h3><p>Create a Dockerfile:</p><pre>FROM openjdk:11-jre-slim<br>VOLUME /tmp<br>COPY target/ssl-hot-reload-demo-0.0.1-SNAPSHOT.jar app.jar<br>ENTRYPOINT [&quot;java&quot;,&quot;-jar&quot;,&quot;/app.jar&quot;]</pre><p>Build and push the Docker image:</p><pre>docker build -t your-dockerhub-username/ssl-hot-reload-demo:latest .<br>docker push your-dockerhub-username/ssl-hot-reload-demo:latest</pre><h3>2. Apply Kubernetes Manifest</h3><p>Deploy your application to Kubernetes:</p><pre>kubectl apply -f deployment.yaml</pre><h3>Testing SSL Hot Reload</h3><p>To test SSL hot reload, update the SSL certificates and observe the Spring Boot application reload them without downtime.</p><ol><li>Generate new SSL certificates and update the Kubernetes secret:</li></ol><pre>openssl req -x509 -newkey rsa:4096 -keyout new-private.key -out new-public.crt -days 365 -nodes -subj &quot;/CN=localhost&quot;<br>openssl pkcs12 -export -in new-public.crt -inkey new-private.key -out new-keystore.p12 -name &quot;ssl-hot-reload&quot; -passout pass:password<br><br>kubectl create secret generic ssl-certs --from-file=new-keystore.p12 --dry-run=client -o yaml | kubectl apply -f -</pre><p>2. The Spring Boot application should detect the change and reload the SSL certificates automatically.</p><h3>Conclusion</h3><p>Implementing SSL hot reload in a Spring Boot application running on Kubernetes ensures secure and uninterrupted service. By leveraging Kubernetes secrets, Spring Cloud Config Watcher, and Actuator, you can dynamically update SSL certificates without downtime, maintaining the security and availability of your application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a592ebce269f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What caused the global outage at Microsoft]]></title>
            <link>https://javafullstackdev.medium.com/what-caused-the-global-outage-at-microsoft-307939520b01?source=rss-5382eb60a9e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/307939520b01</guid>
            <category><![CDATA[what-is-crowdstrike]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[microsoft-365]]></category>
            <category><![CDATA[outrage]]></category>
            <category><![CDATA[crowdstrike]]></category>
            <dc:creator><![CDATA[fullstackjavadev.in]]></dc:creator>
            <pubDate>Fri, 19 Jul 2024 11:25:00 GMT</pubDate>
            <atom:updated>2024-07-19T11:25:00.731Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*83o5Fqbuj-1YVQL_" /><figcaption>Photo by <a href="https://unsplash.com/@cbpsc1?utm_source=medium&amp;utm_medium=referral">Clint Patterson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The global outage at Microsoft, which began on July 19, 2024, was primarily caused by a combination of issues related to a configuration change in Microsoft’s Azure backend and a problematic software update from CrowdStrike, a cybersecurity provider.</p><h3>Key Causes of the Outage</h3><ol><li><strong>Configuration Change in Azure</strong>: Microsoft identified a configuration change within its Azure cloud services as a significant factor leading to connectivity failures between storage and compute resources. This disruption affected various Microsoft 365 applications, making them inaccessible to users worldwide</li><li><strong>CrowdStrike’s Software Update</strong>: Concurrently, a defect in a software update from CrowdStrike’s Falcon sensor, which is widely used for cybersecurity on Windows devices, exacerbated the situation. Many users experienced the “Blue Screen of Death” (BSOD) and were unable to reboot their systems. CrowdStrike acknowledged the issue and confirmed that it was aware of the crashes related to its software.</li></ol><h3>Impact of the Outage</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Re7O6eToACYq2NA5" /><figcaption>Photo by <a href="https://unsplash.com/@medion4you?utm_source=medium&amp;utm_medium=referral">Norbert Braun</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The outage led to widespread disruptions across multiple sectors, including airlines, banks, and media outlets. Major airlines grounded flights, and numerous businesses faced operational challenges due to the inability to access critical systems and applications[2][3][4].</p><p>Microsoft is actively working to mitigate the effects of the outage and restore services, with reports indicating gradual improvements in service availability as efforts progress</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=307939520b01" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create a Package in a Spring Boot Project in VS Code]]></title>
            <link>https://javafullstackdev.medium.com/how-to-create-a-package-in-a-spring-boot-project-in-vs-code-1c79c7f66a3b?source=rss-5382eb60a9e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c79c7f66a3b</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[fullstackjavadev.in]]></dc:creator>
            <pubDate>Sat, 22 Jun 2024 11:51:41 GMT</pubDate>
            <atom:updated>2024-06-22T11:51:41.025Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*BfOUBD1I2fUhsXDcCB7jXQ.png" /></figure><p>Spring Boot is a popular framework for building Java-based applications, and Visual Studio Code (VS Code) is a powerful, lightweight code editor that supports Java development. In this blog, we’ll walk you through creating a Spring Boot project in VS Code, setting up a package structure, and running your application.</p><h4>Prerequisites</h4><p>Before we start, make sure you have the following installed:</p><ul><li><strong>Java Development Kit (JDK)</strong>: You can download it from <a href="https://www.oracle.com/java/technologies/javase-downloads.html">Oracle’s official site</a> or use OpenJDK.</li><li><strong>Maven</strong>: You can download it from <a href="https://maven.apache.org/download.cgi">Maven’s official site</a>.</li><li><strong>Visual Studio Code</strong>: Download it from <a href="https://code.visualstudio.com/">here</a>.</li><li><strong>VS Code Extensions</strong>: Install the following extensions:</li><li><a href="https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack">Java Extension Pack</a></li><li><a href="https://marketplace.visualstudio.com/items?itemName=Pivotal.vscode-spring-boot">Spring Boot Extension Pack</a></li></ul><h4>Step 1: Create a Spring Boot Project</h4><p><strong>Open VS Code</strong> and open the integrated terminal by pressing Ctrl + ` (backtick).</p><p><strong>Generate a Spring Boot project</strong> using Maven with the following command:</p><pre>mvn archetype:generate -DgroupId=com.example -DartifactId=myproject -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false</pre><p>Alternatively, you can use the <a href="https://start.spring.io/">Spring Initializr</a> website to generate a project. Download the project as a ZIP file, extract it, and open the folder in VS Code.</p><h4>Step 2: Open the Project in VS Code</h4><p><strong>Open the project folder</strong> in VS Code. You can do this by navigating to File &gt; Open Folder and selecting the project directory.</p><p><strong>Open the terminal</strong> in VS Code (if it’s not already open) by pressing Ctrl + (backtick).</p><h4>Step 3: Create Packages</h4><p><strong>Navigate to the </strong>src/main/java directory in your project explorer.</p><p><strong>Create new packages</strong> by right-clicking on the java directory, selecting New Folder, and naming it according to your package structure (e.g., com/example/myproject).</p><h4>Step 4: Add Classes to Your Package</h4><p><strong>Right-click on the package</strong> you just created (e.g., com/example/myproject) and select New File.</p><p><strong>Name the file</strong> (e.g., <a href="http://myclass.java/">MyClass.java</a>) and press Enter.</p><p><strong>Define your class</strong> within this file. For example:</p><pre>package com.example.myproject;  public class MyClass {     public static void main(String[] args) {         System.out.println(&quot;Hello, Spring Boot!&quot;);     } }</pre><h4>Step 5: Configure Spring Boot</h4><p>Ensure you have a main application class to run your Spring Boot application. It should be in the root package or a subpackage of it.</p><p>Example <a href="http://application.java/">Application.java</a> in the root package com.example.myproject:</p><pre>package com.example.myproject;<br><br>import org.springframework.boot.SpringApplication;<br>import org.springframework.boot.autoconfigure.SpringBootApplication;<br>@SpringBootApplication<br>public class Application {<br>    public static void main(String[] args) {<br>        SpringApplication.run(Application.class, args);<br>    }<br>}</pre><h4>Step 6: Run Your Spring Boot Application</h4><p><strong>Open the integrated terminal</strong> in VS Code by pressing Ctrl + (backtick).</p><p><strong>Navigate to the project directory</strong> if not already there.</p><p><strong>Use Maven to run your application</strong>:</p><pre>mvn spring-boot:run</pre><p>Alternatively, you can build your project and run the jar file:</p><pre>mvn package java -jar target/myproject-0.0.1-SNAPSHOT.jar</pre><h3>Summary</h3><p>By following these steps, you can create a package structure in your Spring Boot project using VS Code, add classes, configure your application, and run it successfully. This setup allows you to organize your project code logically and maintainably.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c79c7f66a3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Power of Spring WebFlux : An In-Depth Guide to Reactive Web Development]]></title>
            <link>https://javafullstackdev.medium.com/unlocking-the-power-of-spring-webflux-an-in-depth-guide-to-reactive-web-development-91c124506642?source=rss-5382eb60a9e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/91c124506642</guid>
            <category><![CDATA[spring-framework]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[webflux]]></category>
            <dc:creator><![CDATA[fullstackjavadev.in]]></dc:creator>
            <pubDate>Sat, 15 Jun 2024 12:51:11 GMT</pubDate>
            <atom:updated>2024-06-15T12:51:11.440Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unlocking the Power of Spring WebFlux : An In-Depth Guide to Reactive Web Development</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*GOJ2xtp_4xplWFQz1ZiEMw.jpeg" /></figure><h3>Introduction</h3><p>In the rapidly evolving landscape of web development, Spring WebFlux has emerged as a powerful tool for building reactive and non-blocking web applications. Introduced in Spring 5, WebFlux provides an alternative to the traditional Spring MVC framework, catering specifically to applications that require high concurrency and scalability. This blog aims to offer a detailed overview of Spring WebFlux, its key features, advantages, and practical use cases.</p><h3>What is Spring WebFlux?</h3><p>Spring WebFlux is a framework designed to support the development of reactive web applications. It is part of the larger Spring ecosystem and is built on the foundations of Project Reactor, a library for building non-blocking applications on the JVM.</p><h3>Key Characteristics:</h3><ul><li><strong>Reactive Programming</strong>: Utilizes reactive programming principles to handle asynchronous data streams.</li><li><strong>Non-Blocking I/O</strong>: Supports non-blocking I/O operations, which leads to better resource utilization and scalability.</li><li><strong>Backpressure</strong>: Manages the flow of data to ensure that producers do not overwhelm consumers.</li><li><strong>Declarative Syntax</strong>: Employs a declarative style of coding, making the code more readable and maintainable.</li></ul><h3>Core Concepts</h3><h3>Reactive Streams</h3><p>The backbone of Spring WebFlux is the Reactive Streams specification, which defines a standard for asynchronous stream processing with non-blocking backpressure. The four main interfaces of Reactive Streams are:</p><ul><li><strong>Publisher</strong>: Emits a sequence of items to subscribers according to their demand.</li><li><strong>Subscriber</strong>: Consumes items emitted by the Publisher.</li><li><strong>Subscription</strong>: Represents a one-to-one lifecycle of a Subscriber subscribing to a Publisher.</li><li><strong>Processor</strong>: Represents a processing stage which is both a Subscriber and a Publisher.</li></ul><h3>Project Reactor</h3><p>Project Reactor is the reactive library that provides the necessary tools and operators to work with reactive streams in Spring WebFlux. It includes two main types:</p><ul><li><strong>Mono</strong>: Represents a single, potentially empty, asynchronous value.</li><li><strong>Flux</strong>: Represents a sequence of asynchronous values.</li></ul><h3>Router and Handler Functions</h3><p>In Spring WebFlux, routing and handling requests can be done in a functional style. The main components are:</p><ul><li><strong>RouterFunction</strong>: Defines a mapping between a request and a handler.</li><li><strong>HandlerFunction</strong>: Represents the code to handle the request.</li></ul><p>Here’s a simple example of a RouterFunction and HandlerFunction:</p><pre>@Configuration<br>public class RouterConfig {<br><br>@Bean<br>    public RouterFunction&lt;ServerResponse&gt; route(Handler handler) {<br>        return RouterFunctions.route(GET(&quot;/hello&quot;), handler::hello);<br>    }<br>}<br>@Component<br>public class Handler {<br>    public Mono&lt;ServerResponse&gt; hello(ServerRequest request) {<br>        return ServerResponse.ok().bodyValue(&quot;Hello, WebFlux!&quot;);<br>    }<br>}</pre><h3>Advantages of Spring WebFlux</h3><h3>Improved Performance</h3><p>WebFlux’s non-blocking nature allows for better resource utilization, enabling the handling of a large number of requests with a smaller thread pool. This is particularly beneficial for applications with high concurrency requirements.</p><h3>Scalability</h3><p>By avoiding thread blocking, WebFlux applications can scale more efficiently, making them suitable for microservices and cloud-native architectures.</p><h3>Better Responsiveness</h3><p>Reactive programming enables handling of data streams more gracefully, resulting in improved responsiveness and user experience, especially in real-time applications.</p><h3>Flexibility</h3><p>WebFlux supports both annotation-based and functional programming models, providing developers with the flexibility to choose the approach that best fits their needs.</p><h3>Practical Use Cases</h3><h3>Real-Time Applications</h3><p>Applications like chat systems, live notifications, and real-time data processing benefit significantly from WebFlux’s reactive and non-blocking capabilities.</p><h3>Microservices</h3><p>WebFlux is well-suited for microservices architectures, where services need to handle high loads and communicate efficiently.</p><h3>Streaming Data</h3><p>WebFlux excels in scenarios involving streaming data, such as video streaming, live data feeds, and event-driven systems.</p><h3>Getting Started with Spring WebFlux</h3><h3>Setting Up the Project</h3><p>To get started with Spring WebFlux, you can create a new Spring Boot project with the necessary dependencies. You can do this using Spring Initializr or by manually adding dependencies to your build.gradle or pom.xml file.</p><p>Here’s an example pom.xml configuration:</p><pre>&lt;dependencies&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-boot-starter-webflux&lt;/artifactId&gt;<br>    &lt;/dependency&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;io.projectreactor&lt;/groupId&gt;<br>        &lt;artifactId&gt;reactor-core&lt;/artifactId&gt;<br>    &lt;/dependency&gt;<br>    &lt;!-- Other dependencies --&gt;<br>&lt;/dependencies&gt;</pre><h3>Creating a Simple WebFlux Application</h3><ol><li><strong>Define the Router and Handler:</strong></li></ol><pre>import org.springframework.context.annotation.Bean;<br>import org.springframework.context.annotation.Configuration;<br>import org.springframework.web.reactive.function.server.RouterFunction;<br>import org.springframework.web.reactive.function.server.ServerRequest;<br>import org.springframework.web.reactive.function.server.ServerResponse;<br>import org.springframework.web.reactive.function.server.RouterFunctions;<br>import org.springframework.stereotype.Component;<br>import reactor.core.publisher.Mono;<br><br>import static org.springframework.web.reactive.function.server.RequestPredicates.GET;<br>@Configuration<br>public class RouterConfig {<br>    @Bean<br>    public RouterFunction&lt;ServerResponse&gt; route(Handler handler) {<br>        return RouterFunctions.route(GET(&quot;/hello&quot;), handler::hello);<br>    }<br>}<br>@Component<br>public class Handler {<br>    public Mono&lt;ServerResponse&gt; hello(ServerRequest request) {<br>        return ServerResponse.ok().bodyValue(&quot;Hello, WebFlux!&quot;);<br>    }<br>}</pre><p><strong>2. Run the Application:</strong></p><p>Create a main class to run the Spring Boot application:</p><pre>import org.springframework.boot.SpringApplication;<br>import org.springframework.boot.autoconfigure.SpringBootApplication;<br><br>@SpringBootApplication<br>public class WebFluxApplication {<br>    public static void main(String[] args) {<br>        SpringApplication.run(WebFluxApplication.class, args);<br>    }<br>}</pre><h3>Testing the Application</h3><p>To test the application, you can use tools like Postman or simply access <a href="http://localhost:8080/hello">http://localhost:8080/hello</a> in your browser. You should see a response with &quot;Hello, WebFlux!&quot;.</p><h3>Conclusion</h3><p>Spring WebFlux is a powerful and flexible framework for building reactive and non-blocking web applications. Its emphasis on reactive programming and non-blocking I/O makes it well-suited for modern, high-performance web applications. Whether you are building real-time systems, microservices, or streaming data applications, WebFlux provides the tools and abstractions needed to develop scalable and responsive applications.</p><p>As you embark on your journey with Spring WebFlux, remember that the key to mastering it lies in understanding the reactive programming paradigm and leveraging the rich set of features offered by Project Reactor. With its growing popularity and community support, Spring WebFlux is poised to play a significant role in the future of web development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91c124506642" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Reverse a String in Java: A Comprehensive Guide]]></title>
            <link>https://javafullstackdev.medium.com/how-to-reverse-a-string-in-java-a-comprehensive-guide-b2720a975891?source=rss-5382eb60a9e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2720a975891</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[coding-interviews]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[java8]]></category>
            <dc:creator><![CDATA[fullstackjavadev.in]]></dc:creator>
            <pubDate>Fri, 07 Jun 2024 17:03:05 GMT</pubDate>
            <atom:updated>2024-06-07T17:03:05.660Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vah5TSUf4S5tEciI-lHJHg.png" /></figure><p>Reversing a string is a common programming task that can be approached in several ways. In this blog, we’ll explore various methods to reverse a string in Java, providing detailed explanations and sample code for each approach.</p><h3>1. Using StringBuilder</h3><p>The StringBuilder class in Java provides a convenient way to reverse a string. This class has a built-in method called reverse() which we can use.</p><h4>Code Example:</h4><pre>public class ReverseStringExample {<br>    public static void main(String[] args) {<br>        String input = &quot;Hello, World!&quot;;<br>        StringBuilder sb = new StringBuilder(input);<br>        String reversed = sb.reverse().toString();<br>        System.out.println(&quot;Reversed String: &quot; + reversed);<br>    }<br>}</pre><h4>Explanation:</h4><ol><li>We create a StringBuilder object and initialize it with the input string.</li><li>We call the reverse() method on the StringBuilder object.</li><li>We convert the StringBuilder object back to a string using the toString() method.</li><li>Finally, we print the reversed string.</li></ol><h3>2. Using a Character Array</h3><p>Another way to reverse a string is by converting it into a character array, reversing the array, and then constructing a new string from the reversed array.</p><h4>Code Example:</h4><pre>public class ReverseStringExample {<br>    public static void main(String[] args) {<br>        String input = &quot;Hello, World!&quot;;<br>        char[] charArray = input.toCharArray();<br>        int left = 0;<br>        int right = charArray.length - 1;<br>        <br>        while (left &lt; right) {<br>            char temp = charArray[left];<br>            charArray[left] = charArray[right];<br>            charArray[right] = temp;<br>            left++;<br>            right--;<br>        }<br>        <br>        String reversed = new String(charArray);<br>        System.out.println(&quot;Reversed String: &quot; + reversed);<br>    }<br>}</pre><h4>Explanation:</h4><ol><li>Convert the input string into a character array using toCharArray().</li><li>Initialize two pointers, left at the beginning and right at the end of the array.</li><li>Swap the characters at these two pointers.</li><li>Move the pointers towards the center.</li><li>Repeat the process until the pointers meet in the middle.</li><li>Convert the reversed character array back to a string and print it.</li></ol><h3>3. Using Recursion</h3><p>Recursion can also be used to reverse a string by breaking it down into smaller substrings.</p><h4>Code Example:</h4><pre>public class ReverseStringExample {<br>    public static void main(String[] args) {<br>        String input = &quot;Hello, World!&quot;;<br>        String reversed = reverseString(input);<br>        System.out.println(&quot;Reversed String: &quot; + reversed);<br>    }<br>public static String reverseString(String str) {<br>        if (str.isEmpty()) {<br>            return str;<br>        }<br>        return reverseString(str.substring(1)) + str.charAt(0);<br>    }<br>}</pre><h4>Explanation:</h4><ol><li>Define a recursive method reverseString() that takes a string as input.</li><li>If the string is empty, return the string (base case).</li><li>Otherwise, return the reverse of the substring starting from the second character (str.substring(1)) concatenated with the first character (str.charAt(0)).</li><li>The recursion continues until the base case is reached.</li><li>Print the reversed string.</li></ol><h3>4. Using Collections API</h3><p>Java’s Collections class can also be used to reverse a string by working with a list of characters.</p><h4>Code Example:</h4><pre>import java.util.ArrayList;<br>import java.util.Collections;<br>import java.util.List;<br>public class ReverseStringExample {<br>    public static void main(String[] args) {<br>        String input = &quot;Hello, World!&quot;;<br>        List&lt;Character&gt; charList = new ArrayList&lt;&gt;();<br>        for (char c : input.toCharArray()) {<br>            charList.add(c);<br>        }<br>        Collections.reverse(charList);<br>        StringBuilder sb = new StringBuilder(charList.size());<br>        for (char c : charList) {<br>            sb.append(c);<br>        }<br>        String reversed = sb.toString();<br>        System.out.println(&quot;Reversed String: &quot; + reversed);<br>    }<br>}</pre><h4>Explanation:</h4><ol><li>Convert the input string into a list of characters.</li><li>Use the Collections.reverse() method to reverse the list.</li><li>Construct a new string from the reversed list using StringBuilder.</li><li>Print the reversed string.</li></ol><h3>Conclusion</h3><p>Reversing a string in Java can be accomplished in various ways, each with its own advantages and nuances. Whether you use the StringBuilder, a character array, recursion, or the Collections API, understanding these methods will enhance your ability to manipulate strings effectively in Java.</p><p>Feel free to choose the method that best suits your needs and the specific context of your application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2720a975891" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>