<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Felipe Jansen</title>
    <description>The latest articles on DEV Community by Felipe Jansen (@felipejansendeveloper).</description>
    <link>https://dev.to/felipejansendeveloper</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1134043%2F8a8fb94b-c6c1-4f8e-a309-59ee3f282954.jpeg</url>
      <title>DEV Community: Felipe Jansen</title>
      <link>https://dev.to/felipejansendeveloper</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/felipejansendeveloper"/>
    <language>en</language>
    <item>
      <title>LocalStack: Speeding Up Cloud Development Without Leaving Your Machine</title>
      <dc:creator>Felipe Jansen</dc:creator>
      <pubDate>Tue, 20 Jan 2026 13:48:16 +0000</pubDate>
      <link>https://dev.to/felipejansendeveloper/localstack-speeding-up-cloud-development-without-leaving-your-machine-547d</link>
      <guid>https://dev.to/felipejansendeveloper/localstack-speeding-up-cloud-development-without-leaving-your-machine-547d</guid>
      <description>&lt;h2&gt;
  
  
  LocalStack: Speeding Up Cloud Development Without Leaving Your Machine
&lt;/h2&gt;

&lt;p&gt;When building cloud-native applications, one of the biggest productivity killers is the constant dependency on real cloud environments for development and testing.&lt;/p&gt;

&lt;p&gt;That’s where &lt;strong&gt;LocalStack&lt;/strong&gt; really shines.&lt;/p&gt;

&lt;p&gt;LocalStack allows you to &lt;strong&gt;run AWS services locally&lt;/strong&gt;, simulating resources like &lt;strong&gt;S3, DynamoDB, Lambda, API Gateway, SQS, SNS&lt;/strong&gt;, and many others. This means you can develop, test, and debug your applications without deploying every change to AWS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why LocalStack makes a difference
&lt;/h3&gt;

&lt;p&gt;From my experience, using LocalStack brings several practical benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Faster feedback loops&lt;/strong&gt;: no network latency, no waiting for cloud resources&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lower costs&lt;/strong&gt;: avoid unnecessary AWS usage during development&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Production-like environments&lt;/strong&gt;: fewer surprises when deploying&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better CI/CD integration&lt;/strong&gt;: easier to run automated tests locally and in pipelines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s especially useful when working with &lt;strong&gt;microservices&lt;/strong&gt;, &lt;strong&gt;event-driven architectures&lt;/strong&gt;, and &lt;strong&gt;serverless applications&lt;/strong&gt;, where multiple AWS services interact with each other.&lt;/p&gt;

&lt;h3&gt;
  
  
  Local development that scales
&lt;/h3&gt;

&lt;p&gt;By combining LocalStack with tools like &lt;strong&gt;Docker&lt;/strong&gt;, &lt;strong&gt;Docker Compose&lt;/strong&gt;, and infrastructure-as-code solutions, teams can create repeatable and reliable local environments that closely mirror &lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Hands-On with LocalStack: AWS Development on Your Local Machine
&lt;/h2&gt;

&lt;p&gt;When working with AWS-based applications, deploying every small change just to test an integration can be slow, expensive, and frustrating. &lt;strong&gt;LocalStack&lt;/strong&gt; solves this by allowing you to run AWS services locally and test your cloud architecture without leaving your machine.&lt;/p&gt;

&lt;p&gt;This post walks through a &lt;strong&gt;practical LocalStack setup&lt;/strong&gt; and shows how it fits into a real development workflow.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Running LocalStack with Docker
&lt;/h2&gt;

&lt;p&gt;The easiest way to get started is by using &lt;strong&gt;Docker Compose&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;3.8"&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;localstack&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;localstack/localstack&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;4566:4566"&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;SERVICES=s3,dynamodb,lambda,apigateway&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;AWS_DEFAULT_REGION=us-east-1&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;AWS_ACCESS_KEY_ID=test&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;AWS_SECRET_ACCESS_KEY=test&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/var/run/docker.sock:/var/run/docker.sock"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start LocalStack with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker-compose up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All AWS services will be available through a single endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://localhost:4566
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2. Creating Resources Locally
&lt;/h2&gt;

&lt;p&gt;You can interact with LocalStack using the &lt;strong&gt;AWS CLI&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create an S3 bucket
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws &lt;span class="nt"&gt;--endpoint-url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:4566 s3 mb s3://local-bucket
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create a DynamoDB table
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws &lt;span class="nt"&gt;--endpoint-url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:4566 dynamodb create-table &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--table-name&lt;/span&gt; Users &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--attribute-definitions&lt;/span&gt; &lt;span class="nv"&gt;AttributeName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;,AttributeType&lt;span class="o"&gt;=&lt;/span&gt;S &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--key-schema&lt;/span&gt; &lt;span class="nv"&gt;AttributeName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;,KeyType&lt;span class="o"&gt;=&lt;/span&gt;HASH &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--billing-mode&lt;/span&gt; PAY_PER_REQUEST
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This setup behaves just like AWS — but runs &lt;strong&gt;entirely locally&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Using LocalStack with a Java (Spring Boot) Application
&lt;/h2&gt;

&lt;p&gt;In a Spring Boot application, you only need to override the AWS endpoint in your configuration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;cloud&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;aws&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;region&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;static&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt;
    &lt;span class="na"&gt;credentials&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;access-key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;test&lt;/span&gt;
      &lt;span class="na"&gt;secret-key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;test&lt;/span&gt;
    &lt;span class="na"&gt;endpoint&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;dynamodb&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;http://localhost:4566&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your AWS SDK clients and repositories will work exactly the same way as in production.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Testing Event-Driven and Serverless Flows
&lt;/h2&gt;

&lt;p&gt;LocalStack is especially powerful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lambda + API Gateway&lt;/li&gt;
&lt;li&gt;SQS / SNS messaging&lt;/li&gt;
&lt;li&gt;DynamoDB Streams&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can deploy Lambdas locally, trigger them via API Gateway, and debug the full flow without touching AWS.&lt;/p&gt;

&lt;p&gt;This makes it ideal for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integration tests&lt;/li&gt;
&lt;li&gt;Local debugging&lt;/li&gt;
&lt;li&gt;CI/CD pipelines&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Why This Matters in Real Projects
&lt;/h2&gt;

&lt;p&gt;Using LocalStack in real projects helped me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduce feedback time from minutes to seconds&lt;/li&gt;
&lt;li&gt;Catch integration issues earlier&lt;/li&gt;
&lt;li&gt;Keep local and CI environments aligned&lt;/li&gt;
&lt;li&gt;Increase confidence before deploying to production&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;LocalStack shifts cloud development from &lt;em&gt;“deploy and pray”&lt;/em&gt; to &lt;em&gt;“test locally with confidence”&lt;/em&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;LocalStack isn’t just a mock — it’s a &lt;strong&gt;local cloud environment&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you work with AWS, microservices, or serverless architectures, investing time in a solid LocalStack setup pays off quickly in productivity and software quality.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>productivity</category>
      <category>testing</category>
    </item>
    <item>
      <title>Overview of Angular Signals</title>
      <dc:creator>Felipe Jansen</dc:creator>
      <pubDate>Mon, 23 Jun 2025 15:01:54 +0000</pubDate>
      <link>https://dev.to/felipejansendeveloper/overview-of-angular-signals-5fm9</link>
      <guid>https://dev.to/felipejansendeveloper/overview-of-angular-signals-5fm9</guid>
      <description>&lt;h2&gt;
  
  
  🔔 Angular Core Signals Overview
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Angular Signals&lt;/strong&gt; is a new reactivity system in Angular designed to optimize how an application tracks and responds to state changes. Signals simplify how state updates propagate and allow Angular to minimize unnecessary re-renders by targeting only the components or views that actually depend on the changed data.&lt;/p&gt;

&lt;h3&gt;
  
  
  🛠️ What is a Signal?
&lt;/h3&gt;

&lt;p&gt;A &lt;em&gt;signal&lt;/em&gt; is a lightweight reactive wrapper around a value. It notifies any interested consumer (such as templates or computed functions) whenever its value changes. This allows Angular to automatically and efficiently track dependencies in your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  📌 Types of Signals
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Writable Signals:&lt;/strong&gt; Can be updated directly. You create them using the &lt;code&gt;signal()&lt;/code&gt; function:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;counter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Initial value 0&lt;/span&gt;
  &lt;span class="nx"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;            &lt;span class="c1"&gt;// Set to 3&lt;/span&gt;
  &lt;span class="nx"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Increment&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Read-only Signals&lt;/strong&gt;: Expose only a getter and cannot be modified directly from outside.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Computed Signals&lt;/strong&gt;: A special type of signal whose value is derived (computed) from other signals. Whenever the dependencies change, the computed signal is reactively updated.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;computed&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@angular/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;doubled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;computed&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// This recalculates whenever `count` changes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ⚙️ How Signals Work
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dependency Tracking:&lt;/strong&gt; When a signal's getter is invoked in a reactive context (such as an Angular template), Angular registers this context as a dependent. Whenever the signal's value changes, Angular knows exactly which parts of the UI or application logic need to be updated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Equality Checking:&lt;/strong&gt; You can provide an equality comparator when creating a signal. If the comparator determines that a new value is equal to the current value, Angular will not propagate the change, minimizing unnecessary work.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔍 Usage Example
&lt;/h3&gt;

&lt;p&gt;Here's a simple example of a counter component using signals:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;app&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`
    &amp;lt;h1&amp;gt;Current value of the counter {{ counter() }}&amp;lt;/h1&amp;gt;
    &amp;lt;button (click)="increment()"&amp;gt;Increment&amp;lt;/button&amp;gt;
  `&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AppComponent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;counter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the UI is automatically and efficiently updated only when the &lt;code&gt;counter&lt;/code&gt; signal changes, without the need for manual input tracking or complex change detection logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  🚀 Advantages of Signals in Angular
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fine-grained Reactivity:&lt;/strong&gt; Only parts of the UI directly dependent on changed signals are re-rendered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Declarative State Management:&lt;/strong&gt; Code becomes clearer and more predictable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance:&lt;/strong&gt; Reduces unnecessary DOM updates and change detection cycles.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explicit Dependency Declaration:&lt;/strong&gt; Signals are automatically tracked in reactive contexts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Summary Table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Primitive&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;th&gt;How it's used&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;signal&lt;/td&gt;
&lt;td&gt;Holds a writable or read-only value&lt;/td&gt;
&lt;td&gt;&lt;code&gt;const s = signal(initialValue)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;computed&lt;/td&gt;
&lt;td&gt;Derives value from other signals&lt;/td&gt;
&lt;td&gt;&lt;code&gt;const c = computed(() =&amp;gt; s() * 2)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;effect&lt;/td&gt;
&lt;td&gt;Responds to changes in one or more signals&lt;/td&gt;
&lt;td&gt;&lt;code&gt;effect(() =&amp;gt; doSomething(s()))&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>angular</category>
      <category>angularcore</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>🔍 Heap Memory vs. Stack Memory in Java: What’s the Difference?</title>
      <dc:creator>Felipe Jansen</dc:creator>
      <pubDate>Thu, 15 Aug 2024 04:06:33 +0000</pubDate>
      <link>https://dev.to/felipejansendeveloper/heap-memory-vs-stack-memory-in-java-whats-the-difference-1lnm</link>
      <guid>https://dev.to/felipejansendeveloper/heap-memory-vs-stack-memory-in-java-whats-the-difference-1lnm</guid>
      <description>&lt;p&gt;When it comes to memory management in Java, two fundamental concepts that every developer should understand are Heap Memory and Stack Memory. Grasping the difference between these two is crucial for writing efficient code and avoiding issues like memory leaks or overflow.&lt;/p&gt;

&lt;p&gt;💡 &lt;strong&gt;Stack Memory&lt;/strong&gt;&lt;br&gt;
Stack Memory is used to store local variables and method calls. Each time a method is invoked, a new "stack frame" is created to store the method's variables and the return address. Once the method completes, the frame is removed, instantly freeing up the memory. The Stack is highly efficient but limited in size.&lt;/p&gt;

&lt;p&gt;📂 &lt;strong&gt;Heap Memory&lt;/strong&gt;&lt;br&gt;
Heap Memory, on the other hand, is where objects in Java are stored. Unlike the Stack, the Heap has a larger size and allows for dynamic memory allocation. Objects allocated on the Heap remain there until there are no more references to them, at which point the Garbage Collector kicks in to free up that memory. The Heap is more flexible, but accessing it is slightly slower compared to the Stack.&lt;/p&gt;

&lt;p&gt;⚖️ &lt;strong&gt;Why Does It Matter?&lt;/strong&gt;&lt;br&gt;
Understanding how Stack and Heap memory work can help you optimize resource usage and avoid issues like StackOverflowError (when the Stack is full) or OutOfMemoryError (when the Heap can't allocate more objects). Knowing when and where to allocate memory is essential for creating robust and efficient Java applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  Java #Programming #SoftwareDevelopment #MemoryManagement #HeapVsStack
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>🎓 Understanding the Difference Between Checked and Unchecked Exceptions in Java 🚀</title>
      <dc:creator>Felipe Jansen</dc:creator>
      <pubDate>Mon, 12 Aug 2024 14:57:07 +0000</pubDate>
      <link>https://dev.to/felipejansendeveloper/understanding-the-difference-between-checked-and-unchecked-exceptions-in-java-bph</link>
      <guid>https://dev.to/felipejansendeveloper/understanding-the-difference-between-checked-and-unchecked-exceptions-in-java-bph</guid>
      <description>&lt;p&gt;If you've worked with Java, you've certainly encountered exceptions. &lt;/p&gt;

&lt;p&gt;But do you know the difference between checked and unchecked exceptions? 🤔&lt;/p&gt;

&lt;p&gt;🔍 &lt;strong&gt;Checked Exceptions:&lt;/strong&gt; These are exceptions that the compiler forces you to handle. They typically represent conditions that can occur due to factors outside the program's control, like network issues 🌐 or I/O failures 📝. For example, when trying to open a file that doesn’t exist, a &lt;code&gt;FileNotFoundException&lt;/code&gt; is thrown. &lt;/p&gt;

&lt;p&gt;As a developer, you must either handle these exceptions (using a try-catch block) or declare that the method can throw them (using throws in the method signature).&lt;/p&gt;

&lt;p&gt;🔍 &lt;strong&gt;Unchecked Exceptions:&lt;/strong&gt; These exceptions are subclasses of RuntimeException and are not checked by the compiler. They usually indicate programming errors, such as trying to access an array index out of bounds (&lt;code&gt;ArrayIndexOutOfBoundsException&lt;/code&gt;) 🛑 or dividing by zero (&lt;code&gt;ArithmeticException&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Since they aren't mandatory to handle, you can choose to catch them or let them propagate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚖️ When to Use Which?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use checked exceptions for situations where failure is expected and recoverable 🔄.&lt;/p&gt;

&lt;p&gt;Use unchecked exceptions to indicate programming errors that ideally should be fixed rather than handled 🛠️.&lt;/p&gt;

&lt;p&gt;Understanding this difference helps you write more robust code 💪 and make better decisions when dealing with errors. How do you usually handle exceptions in your code? Share your experiences in the comments! 💬&lt;/p&gt;

&lt;h1&gt;
  
  
  Java #Programming #SoftwareDevelopment #Exceptions #CodingBestPractices
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>🔍 Understanding the Differences: List, ArrayList, and LinkedList in Java 🔍</title>
      <dc:creator>Felipe Jansen</dc:creator>
      <pubDate>Thu, 08 Aug 2024 20:23:01 +0000</pubDate>
      <link>https://dev.to/felipejansendeveloper/understanding-the-differences-list-arraylist-and-linkedlist-in-java-5h9o</link>
      <guid>https://dev.to/felipejansendeveloper/understanding-the-differences-list-arraylist-and-linkedlist-in-java-5h9o</guid>
      <description>&lt;p&gt;As developers, we work with different data structures daily. In the Java ecosystem, three of the most commonly used are List, ArrayList, and LinkedList.&lt;/p&gt;

&lt;p&gt;While they might seem similar at first glance, each has its peculiarities and specific uses. Let’s dive deeper:&lt;/p&gt;

&lt;p&gt;☑ &lt;strong&gt;List&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;List is an interface in the Java Collection Framework that extends Collection. It defines an ordered collection type that allows duplicate elements. Some key operations include addition, removal, search, and iteration. List serves as the base for many implementations, including ArrayList and LinkedList.&lt;/p&gt;

&lt;p&gt;☑ &lt;strong&gt;ArrayList&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ArrayList is an implementation of the List interface based on a dynamic array. Some important characteristics include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Fast Access: Element access is very fast (O(1)) due to the array index.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dynamic Growth: Automatically grows as new elements are added.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Slow Insertion and Removal: Inserting or removing elements in the middle of the list can be costly (O(n)) due to the shifting of elements.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🌟 When to use: When you need fast access and are not concerned with frequent insertions or deletions of elements in the middle of the list.&lt;/p&gt;

&lt;p&gt;☑ &lt;strong&gt;LinkedList&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;LinkedList also implements the List interface but is based on a doubly linked list data structure. Some important characteristics include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Fast Insertion and Removal: Insertions and deletions are efficient (O(1)) at the ends (beginning and end) of the list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Slow Access: Accessing elements is slower (O(n)) because it requires iterating through the nodes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Flexibility: Can be used as a queue or deque (double-ended queue) due to its linked nature.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🌟 When to use: When the application requires many insertions and deletions of elements, especially at the beginning or end of the list, and fast random access is not critical.&lt;/p&gt;

&lt;p&gt;🎯 &lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Choosing between ArrayList and LinkedList depends on the specific use case of your application. Understanding the characteristics of each implementation can help you optimize your code's performance and efficiency. Knowledge is power! 🚀&lt;/p&gt;

&lt;p&gt;I hope this helps clarify the differences and aids you in making the right choice for your next project! If you have questions or want to discuss more about data structures in Java, drop a comment below! 👇&lt;/p&gt;

&lt;h1&gt;
  
  
  Java #Development #DataStructures #Programming #SoftwareDevelopment
&lt;/h1&gt;

</description>
      <category>java</category>
      <category>softwaredevelopment</category>
      <category>coding</category>
      <category>datastructures</category>
    </item>
    <item>
      <title>🔍 Understanding the N+1 Problem: A Common Performance Pitfall in Database Queries 🛠️</title>
      <dc:creator>Felipe Jansen</dc:creator>
      <pubDate>Wed, 07 Aug 2024 17:59:49 +0000</pubDate>
      <link>https://dev.to/felipejansendeveloper/understanding-the-n1-problem-a-common-performance-pitfall-in-database-queries-304j</link>
      <guid>https://dev.to/felipejansendeveloper/understanding-the-n1-problem-a-common-performance-pitfall-in-database-queries-304j</guid>
      <description>&lt;p&gt;As developers, we've all encountered performance bottlenecks that can be tricky to diagnose and solve. One such issue is the N+1 problem, a common yet often overlooked challenge in database query optimization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So, what is the N+1 problem?&lt;/strong&gt; 🤔 It occurs when your application makes an initial query to retrieve a list of items (say, users) and then makes additional queries for each item to fetch related data (like each user's posts). This results in N+1 queries—one for the initial list and one for each item in that list.&lt;/p&gt;

&lt;p&gt;Imagine you have 100 users, and for each user, you need to fetch their posts. Instead of 1 query to get all users and 1 more to get all posts, you end up with 1 query for users + 100 queries for posts. 📈 This inefficiency can lead to significant performance issues, increasing latency and putting unnecessary load on your database. 💾&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔧 How can we tackle the N+1 problem?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Eager Loading:&lt;/strong&gt; Fetch all required data in a single query using joins or includes, reducing the number of queries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batch Processing:&lt;/strong&gt; Group related queries together to minimize database round-trips.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Query Optimization:&lt;/strong&gt; Regularly review and optimize your queries to ensure they're as efficient as possible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Addressing the N+1 problem is crucial for improving application performance and providing a smoother user experience. Let’s stay vigilant and proactive in identifying and solving these issues to build faster, more efficient applications. 🚀&lt;/p&gt;

&lt;h1&gt;
  
  
  SoftwareDevelopment #DatabaseOptimization #PerformanceTuning #CodingTips #DeveloperLife #TechTips #Programming
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>🚀 Understanding Map and HashMap in Java 🚀</title>
      <dc:creator>Felipe Jansen</dc:creator>
      <pubDate>Tue, 06 Aug 2024 03:30:04 +0000</pubDate>
      <link>https://dev.to/felipejansendeveloper/understanding-map-and-hashmap-in-java-17f9</link>
      <guid>https://dev.to/felipejansendeveloper/understanding-map-and-hashmap-in-java-17f9</guid>
      <description>&lt;p&gt;Have you ever wondered how to efficiently store key-value pairs in Java? 🤔 If so, let's talk about two essential structures: Map and HashMap.&lt;/p&gt;

&lt;p&gt;🔍 &lt;strong&gt;What is a Map?&lt;/strong&gt;&lt;br&gt;
Map is an interface in Java that represents a collection of key-value pairs, where each key is unique. This means you can use Map to map a specific key to a specific value, allowing for quick and efficient lookups.&lt;/p&gt;

&lt;p&gt;🌟 &lt;strong&gt;Introducing HashMap&lt;/strong&gt;&lt;br&gt;
HashMap is a concrete implementation of the Map interface, based on the hash table data structure. It offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;O(1)&lt;/strong&gt; complexity for insertion and lookup operations in most cases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility&lt;/strong&gt;: allows null as a key and value.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt;: ideal for scenarios where the order of keys is not relevant.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🚀 &lt;strong&gt;Benefits of HashMap:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Efficiency&lt;/strong&gt;: Fast insertion, removal, and lookup operations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simplicity&lt;/strong&gt;: Easy to use and implement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Versatility&lt;/strong&gt;: Can store any type of data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚠️ &lt;strong&gt;Points to Consider:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unordered&lt;/strong&gt;: The order of elements is not guaranteed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Synchronization&lt;/strong&gt;: Not thread-safe by default. Use Collections.synchronizedMap for synchronization.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding these structures can take your Java knowledge to the next level, providing more efficient and elegant solutions! 💼💡&lt;/p&gt;

&lt;p&gt;Share your experiences with Map and HashMap in the comments! 👇&lt;/p&gt;

</description>
      <category>java</category>
      <category>hashmap</category>
      <category>programming</category>
      <category>coding</category>
    </item>
    <item>
      <title>How we can create a Pix Qrcode using Java ☕ and Spring 🍃</title>
      <dc:creator>Felipe Jansen</dc:creator>
      <pubDate>Mon, 29 Jul 2024 19:48:14 +0000</pubDate>
      <link>https://dev.to/felipejansendeveloper/how-we-can-create-a-pix-qrcode-using-java-and-spring-17gi</link>
      <guid>https://dev.to/felipejansendeveloper/how-we-can-create-a-pix-qrcode-using-java-and-spring-17gi</guid>
      <description>&lt;p&gt;Hey everyone! Good morning, good afternoon, and good evening!!! Let’s talk about money! #letstalkaboutmoney&lt;/p&gt;

&lt;p&gt;In this post, I'll show you how to create a Pix code and then generate a QR code from it. Let’s dive in! 🚀📲&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F35orgojv5gias15skt7i.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F35orgojv5gias15skt7i.gif" alt="Image description" width="500" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Creating a Pix code is pretty straightforward, but it’s worth checking out BACEN’s documentation. Since they’re behind Pix, it’s a good idea to follow their guidelines. 😉📋&lt;/p&gt;

&lt;p&gt;For that, here’s the guide we’ll be using: &lt;a href="https://www.bcb.gov.br/content/estabilidadefinanceira/pix/Regulamento_Pix/II_ManualdePadroesparaIniciacaodoPix.pdf" rel="noopener noreferrer"&gt;https://www.bcb.gov.br/content/estabilidadefinanceira/pix/Regulamento_Pix/II_ManualdePadroesparaIniciacaodoPix.pdf&lt;/a&gt;. Check it out! 📚&lt;/p&gt;

&lt;p&gt;If you’re panicking about your feature’s deadline and can’t squeeze in time for the documentation, don’t worry—I’ll break down the key points for you right here… 😉&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbkf8misy4je0fcif7nnc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbkf8misy4je0fcif7nnc.png" alt="Image description" width="800" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is an example of a Pix code generated from the table above. If you look closely, you'll see it's pretty straightforward—just follow the info from the table. Also, keep in mind that the most likely things to change are the Pix key and the amount.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe5067r2vc9pr62v8qxtx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe5067r2vc9pr62v8qxtx.png" alt="Image description" width="601" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Without further ado, let’s get to the point.&lt;/p&gt;

&lt;p&gt;The format is &lt;strong&gt;ID + Tam + Valor&lt;/strong&gt;, and we’ll be concatenating the information. Additionally, some fields require you to include both the information and the string length. This applies specifically to Merchant Account Information, Transaction Currency, and Merchant City.&lt;/p&gt;

&lt;p&gt;PS.: The details that change most often are the key (which is the Pix key itself), Transaction Currency, Merchant Name, and Merchant City. You’ll need to replace these with the Pix key, the amount, the name of the recipient, and the recipient's city.&lt;/p&gt;

&lt;p&gt;PS. 2: After completing the procedure, we need to make sure the code is valid. To do this, we’ll run a Cyclic Redundancy Check (CRC) on it (&lt;a href="https://en.wikipedia.org/wiki/Cyclic_redundancy_check" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/Cyclic_redundancy_check&lt;/a&gt;) and append the generated CRC code to the end of the Pix code. This will validate the Pix code. The Java code for this is provided below.&lt;/p&gt;

&lt;p&gt;PS 3 .: The &lt;strong&gt;txid&lt;/strong&gt; field refers to the Pix description field—the message field provided by BACEN that lets us send messages with our Pix transactions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private static String CRC16CCITT(String payload) {
        int crc = 0xFFFF;          // initial value
        int polynomial = 0x1021;   // 0001 0000 0010 0001  (0, 5, 12)

        byte[] bytes = payload.getBytes(Charset.defaultCharset());

        for (byte b : bytes) {
            for (int i = 0; i &amp;lt; 8; i++) {
                boolean bit = ((b   &amp;gt;&amp;gt; (7-i) &amp;amp; 1) == 1);
                boolean c15 = ((crc &amp;gt;&amp;gt; 15    &amp;amp; 1) == 1);
                crc &amp;lt;&amp;lt;= 1;
                if (c15 ^ bit) crc ^= polynomial;
            }
        }

        crc &amp;amp;= 0xffff;
        return Integer.toHexString(crc);
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it—this is how you create a Pix code. To generate the QR code, just take the text and plug it into your preferred QR code generator. I like using &lt;a href="https://www.qr-code-generator.com/solutions/text-qr-code/" rel="noopener noreferrer"&gt;QR Code Generator&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fos68ys6gyh7qknq5i0nk.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fos68ys6gyh7qknq5i0nk.gif" alt="Image description" width="500" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Useful Links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Explanation of CRC16: &lt;a href="https://fastercapital.com/content/All-You-Need-to-Know-About-CRC16--Detecting-Errors-in-Data-Transmission.html#:~:text=CRC16%20is%20a%20type%20of,a%20checksum%20to%20the%20packet." rel="noopener noreferrer"&gt;All You Need to Know About CRC16 - Detecting Errors in Data Transmission&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CRC on Wikipedia: &lt;a href="https://pt.wikipedia.org/wiki/CRC" rel="noopener noreferrer"&gt;Cyclic Redundancy Check (CRC)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Link for repository of this project: &lt;a href="https://github.com/FelipeJansenDev/pix-java-spring/blob/master/PixService.java" rel="noopener noreferrer"&gt;PixService.java&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Follow me on Linkedin for more:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/felipe-neiva-jansen/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/felipe-neiva-jansen/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>pix</category>
      <category>qrcode</category>
    </item>
    <item>
      <title>Passing erros throught microsservices (Java + Spring)</title>
      <dc:creator>Felipe Jansen</dc:creator>
      <pubDate>Thu, 11 Jul 2024 03:11:10 +0000</pubDate>
      <link>https://dev.to/felipejansendeveloper/passing-erros-throught-microsservices-java-spring-3iam</link>
      <guid>https://dev.to/felipejansendeveloper/passing-erros-throught-microsservices-java-spring-3iam</guid>
      <description>&lt;p&gt;Hey folks! Here's another quick tip for you: today, we're diving into handling exceptions in Java and how we can smoothly manage errors across microservices (among other approaches). Let's learn together! 👨‍💻🚀&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjn8655etfo8trp8p6w70.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjn8655etfo8trp8p6w70.png" alt="Image description" width="423" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some time ago, I came across an issue where I needed to pass an error to the BFF (Backend-for-frontend). In essence, we have three microservices: one BFF, and others that handle the business logic of the application. Errors triggered within the business logic need to at least return a message to the BFF. This allows the frontend to determine the best error message and the most appropriate way to handle that specific error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj6x25ptnf9ndo0xwe11i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj6x25ptnf9ndo0xwe11i.png" alt="Image description" width="512" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In short, the approach is quite straightforward: the server sends an error code through a header, and both the frontend and BFF are responsible for reading this code and returning a formatted JSON response to the frontend. Here are the steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Trigger an exception on the server, passing the error code.&lt;/li&gt;
&lt;li&gt;The ExceptionHandler handles this exception and inserts the error code into a header called "CODE".&lt;/li&gt;
&lt;li&gt;On the BFF side, this error is captured and a JSON response is constructed to be sent back to the frontend.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Here's a rough outline of how the code might look:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Service
public class ServerService {

    public Sucesso testMethod(Long id) {
        if (id == 1) {
            throw new ServerException(HttpStatus.BAD_REQUEST, ERROR_001);
        } else if (id == 2) {
            throw new ServerException(HttpStatus.BAD_REQUEST, ERROR_002);
        } else if (id == 3) {
            throw new ServerException(HttpStatus.BAD_REQUEST, ERROR_003);
        }
        return Sucesso.builder().id(id).build();
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Afterward, on the server side, this is the class responsible for handling triggered errors and adding the error code into the respective header!&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@RestControllerAdvice
public class ControlExceptionHandler {

    public static final String CODE = "CODE";

    @ExceptionHandler({ServerException.class})
    public ResponseEntity&amp;lt;Object&amp;gt; serverException(ServerException e) {
        HttpHeaders responseHeaders = new HttpHeaders();
        responseHeaders.add(CODE, e.getCode());
        return ResponseEntity.status(e.getHttpStatusCode()).headers(responseHeaders).build();
    }

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;On our BFF side, we use the &lt;code&gt;.onStatus()&lt;/code&gt; method to check if an error occurred in the request and take appropriate actions (in this case, throwing a &lt;code&gt;ClientException&lt;/code&gt; based on the obtained response)."&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Service
public class ServerService {

    public static final String CODE = "CODE";
    private final RestClient restClient;

    public ServerService(RestClient restClient) {
        this.restClient = restClient;
    }

    public Sucesso testMethod(Long id) {
        return restClient
                .get()
                .uri("http://localhost:8080?id=" + id)
                .retrieve()
                .onStatus(HttpStatusCode::isError, (HttpRequest request, ClientHttpResponse response) -&amp;gt; {
                    throw new ClientException(HttpStatus.BAD_REQUEST, Objects.requireNonNull(response.getHeaders().get(CODE)).get(0));
                })
                .body(Sucesso.class);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;And then, still on the BFF side, we construct the response for the Frontend based on the header captured from the response.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@RestControllerAdvice
public class ControlExceptionHandler {

    @ExceptionHandler({ClientException.class})
    public ResponseEntity&amp;lt;Object&amp;gt; ClientException(ClientException e) {
        return ResponseEntity.status(e.getHttpStatusCode()).body(e.getOnlyBody());
    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Finally, this is the result that we expect.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftqb7kfyclk3jr6nop60a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftqb7kfyclk3jr6nop60a.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Here's the code on github: &lt;a href="https://github.com/FelipeJansenDev/errors-between-microsservices" rel="noopener noreferrer"&gt;https://github.com/FelipeJansenDev/errors-between-microsservices&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow me on Linkedin for more tips and tricks: &lt;a href="https://www.linkedin.com/in/felipe-neiva-jansen/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/felipe-neiva-jansen/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>spring</category>
      <category>exceptions</category>
      <category>microservices</category>
    </item>
    <item>
      <title>Implementing an Interceptor for RestClient (Java + Spring Boot)</title>
      <dc:creator>Felipe Jansen</dc:creator>
      <pubDate>Tue, 25 Jun 2024 15:23:33 +0000</pubDate>
      <link>https://dev.to/felipejansendeveloper/implementing-an-interceptor-for-restclient-java-spring-boot-3h75</link>
      <guid>https://dev.to/felipejansendeveloper/implementing-an-interceptor-for-restclient-java-spring-boot-3h75</guid>
      <description>&lt;p&gt;Hello, everyone! Today, I'll be showing you a straightforward way to set up an interceptor in the new RestClient class of the Spring Framework.&lt;/p&gt;

&lt;p&gt;1º) First, let's create our project. We'll keep it simple, just for study purposes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm9i700ke2hlojs4ub7rz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm9i700ke2hlojs4ub7rz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2º) Next, let's create our class that will be used as the interceptor.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@Component
public class RestClientInterceptor implements ClientHttpRequestInterceptor {

    @Override
    public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
        request.getHeaders().add("header1", "header 1 value");
        return execution.execute(request, body);
    }

}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;According to the Spring Framework documentation, the &lt;code&gt;ClientHttpRequestInterceptor&lt;/code&gt; interface is a contract to intercept client-side HTTP requests. Implementations can be registered with &lt;code&gt;RestClient&lt;/code&gt; or &lt;code&gt;RestTemplate&lt;/code&gt; to modify the outgoing request and/or the incoming response. The interface contains the method &lt;code&gt;intercept&lt;/code&gt;, which intercepts the given request and returns a response. The provided &lt;code&gt;ClientHttpRequestExecution&lt;/code&gt; allows the interceptor to pass on the request and response to the next entity in the chain.&lt;/p&gt;

&lt;p&gt;3º) Let's configure our RestClient Bean.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@Configuration
public class RestClientConfig {

    @Bean
    RestClient restClient() {
        return RestClient.builder().baseUrl(null).requestInterceptor(new RestClientInterceptor()).build();
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;4º) Now, let's create the classes to test our interceptor. We will need a service class to make HTTP requests and a test class to verify that the interceptor is working correctly.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@Service
public class Client {

    private final org.springframework.web.client.RestClient restClient;

    public Client(org.springframework.web.client.RestClient restClient) {
        this.restClient = restClient;
    }

    public void restClientAct() {
        restClient.post().retrieve();
    }

}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@RestController
@RequestMapping("/")
public class RestClientController {

    private final Client request;

    public RestClientController(Client request) {
        this.request = request;
    }

    @GetMapping()
    public void getAccount(){
        request.restClientAct();
    }

}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;5º) Done! Here is the curl command to test the endpoint:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl --location 'localhost:8080'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I think that's it. This basic code should address your need to intercept requests made from the RestClient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here's the code on github:&lt;/strong&gt; &lt;a href="https://github.com/FelipeJansenDev/rest-client-interceptor" rel="noopener noreferrer"&gt;https://github.com/FelipeJansenDev/rest-client-interceptor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Follow me on Linkedin for more tips and tricks:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/felipe-neiva-jansen/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/felipe-neiva-jansen/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>spring</category>
      <category>springboot</category>
    </item>
  </channel>
</rss>
