<?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: TheCodeAlchemist</title>
    <description>The latest articles on DEV Community by TheCodeAlchemist (@therealdumbprogrammer).</description>
    <link>https://dev.to/therealdumbprogrammer</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%2F1039737%2F40cc3d30-7613-4ce1-8f9f-b62fd9a695e2.png</url>
      <title>DEV Community: TheCodeAlchemist</title>
      <link>https://dev.to/therealdumbprogrammer</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/therealdumbprogrammer"/>
    <language>en</language>
    <item>
      <title>Introducing Archify: From Architecture Idea to Spring Boot Code</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Sat, 07 Mar 2026 14:26:19 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/introducing-archify-from-architecture-idea-to-spring-boot-code-29j3</link>
      <guid>https://dev.to/therealdumbprogrammer/introducing-archify-from-architecture-idea-to-spring-boot-code-29j3</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://archify-brown.vercel.app/" rel="noopener noreferrer"&gt;https://archify-brown.vercel.app/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every backend developer has experienced this moment.&lt;/p&gt;

&lt;p&gt;You start a new project. You already know the architecture in your head. Maybe it is a simple REST service with a database. Maybe two services communicating with each other. But before you can work on real logic, you spend time doing the same setup again.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create the project.&lt;/li&gt;
&lt;li&gt;Add dependencies.&lt;/li&gt;
&lt;li&gt;Create entities.&lt;/li&gt;
&lt;li&gt;Create repositories.&lt;/li&gt;
&lt;li&gt;Create services.&lt;/li&gt;
&lt;li&gt;Create controllers.&lt;/li&gt;
&lt;li&gt;Wire everything together.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this is hard. But it is repetitive.&lt;br&gt;
That is why I started building Archify.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Archify is a tool that turns an architecture idea into a ready to run Spring Boot project.&lt;br&gt;
Instead of manually creating boilerplate, you define the architecture and Archify generates the code.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Modern backend development is heavily architecture driven. When starting a project we already know the basic structure.&lt;br&gt;
For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A REST service&lt;/li&gt;
&lt;li&gt;A PostgreSQL database&lt;/li&gt;
&lt;li&gt;A few entities&lt;/li&gt;
&lt;li&gt;CRUD APIs
Maybe multiple services communicating with each other
But tools today only solve part of the problem.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Spring Initializr helps you create a basic project skeleton. It adds dependencies and basic configuration. But it does not generate actual application structure like entities, repositories, or controllers.&lt;br&gt;
Other tools often require complex configuration or opinionated frameworks.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What developers often want is something simpler.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define architecture.&lt;/li&gt;
&lt;li&gt;Generate working code.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  The Idea Behind Archify
&lt;/h2&gt;

&lt;p&gt;Archify takes a different approach.&lt;br&gt;
Instead of starting from a project template, you start from an architecture recipe.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;REST service with PostgreSQL.&lt;/li&gt;
&lt;li&gt;Or two services communicating via REST.&lt;/li&gt;
&lt;li&gt;Once the recipe is selected, you define the domain model.
Example:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User
  name: String
  email: String
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Archify then generates a complete Spring Boot service with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Entity&lt;/li&gt;
&lt;li&gt;Repository&lt;/li&gt;
&lt;li&gt;Service layer&lt;/li&gt;
&lt;li&gt;REST controller&lt;/li&gt;
&lt;li&gt;Database configuration&lt;/li&gt;
&lt;li&gt;Maven build setup&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The generated project can be started immediately.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./mvnw spring-boot:run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Architecture as YAML
&lt;/h2&gt;

&lt;p&gt;One feature I wanted to support early was a simple way to share architectures.&lt;br&gt;
Instead of describing architecture in text, Archify lets you export it as YAML.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;recipe: rest-postgres

serviceName: user-service

entities:
  - name: User
    fields:
      - name: name
        type: String
      - name: email
        type: String
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This YAML becomes a shareable architecture blueprint.&lt;br&gt;
You can send it to a teammate.&lt;br&gt;
Store it in documentation.&lt;br&gt;
Use it in examples.&lt;br&gt;
Anyone can paste the YAML into Archify and generate the same project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Visual Architecture Preview
&lt;/h2&gt;

&lt;p&gt;Another goal was to make architecture visible.&lt;br&gt;
When selecting a recipe, Archify shows a simple diagram representing the architecture. For example a service connected to a database or two services communicating with each other.&lt;br&gt;
The preview updates as the configuration changes. This helps developers understand what they are generating before any code is created.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current Scope
&lt;/h2&gt;

&lt;p&gt;Archify is currently focused on common backend patterns such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;REST service with H2&lt;/li&gt;
&lt;li&gt;REST service with PostgreSQL&lt;/li&gt;
&lt;li&gt;Two services communicating through REST
The goal is not to cover every possible architecture but to make common setups quick and easy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why I Built It
&lt;/h2&gt;

&lt;p&gt;The idea came from repeated friction when starting new backend services.&lt;br&gt;
Even experienced developers spend time creating the same scaffolding again and again. That time could be better spent building real features.&lt;/p&gt;

&lt;p&gt;Archify tries to remove that friction.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Describe the architecture.&lt;/li&gt;
&lt;li&gt;Generate the service.&lt;/li&gt;
&lt;li&gt;Start building.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What’s Next
&lt;/h2&gt;

&lt;p&gt;The next steps for Archify include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More architecture recipes&lt;/li&gt;
&lt;li&gt;Sharing architecture blueprints&lt;/li&gt;
&lt;li&gt;Better visualization of service interactions
The long term vision is to make architecture definition the starting point of backend development.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;Archify is open source and available on GitHub.&lt;br&gt;
If you build Spring Boot services regularly, I would love your feedback.&lt;br&gt;
The project is still early, but the goal is simple.&lt;br&gt;
Make it easier to turn architecture ideas into working backend code.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>java</category>
      <category>opensource</category>
      <category>springboot</category>
    </item>
    <item>
      <title>Java to LLMs: Exploring the LLMs Fundamentals</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Tue, 25 Feb 2025 14:05:59 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/java-to-llms-exploring-the-llms-fundamentals-1j5l</link>
      <guid>https://dev.to/therealdumbprogrammer/java-to-llms-exploring-the-llms-fundamentals-1j5l</guid>
      <description>&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.youtube.com/playlist?list=PLpxcSt9FGVVERRWBvQ8I4k8poVqQVwydm" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ytimg.com%2Fvi%2FB0Ok-dBehbM%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCOADEI4CSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLBjQ1PZxo-b9S3Q6tGn_SCE2sMIhA%26days_since_epoch%3D20144" height="270" class="m-0" width="480"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.youtube.com/playlist?list=PLpxcSt9FGVVERRWBvQ8I4k8poVqQVwydm" rel="noopener noreferrer" class="c-link"&gt;
          AI/ML - YouTube
        &lt;/a&gt;
      &lt;/h2&gt;
        
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.youtube.com%2Fs%2Fdesktop%2F895092ef%2Fimg%2Flogos%2Ffavicon.ico" width="800" height="400"&gt;
        youtube.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;As a long-time Java developer, I’ve always enjoyed the world of programming. Recently, I found myself increasingly curious about LLMs. It has really become impossible to ignore advances in AI space.&lt;/p&gt;

&lt;p&gt;Here I’m sharing my personal journey as I started exploring Large Language Models (LLMs). &lt;/p&gt;

&lt;p&gt;If you’re a developer like me, confused with buzz words but eager to understand how modern language models work without diving into heavy hands-on coding right away, this might resonate with you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 1: Diving into AI, ML, and Data Fundamentals&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I started by revisiting some core concepts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;What is AI?&lt;/strong&gt;&lt;br&gt;
Coming from a Java background, I was used to writing explicit instructions in code. AI, however, is about creating systems that learn from data rather than following hard-coded rules. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Machine Learning &amp;amp; Deep Learning&lt;/strong&gt;&lt;br&gt;
ML intrigued me because it’s all about algorithms that improve over time. I learned that while traditional programming relies on clear logic, ML uses statistical methods to find patterns. Deep Learning took it a step further by mimicking the human brain with neural networks. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Understanding NLP&lt;/strong&gt;&lt;br&gt;
Natural Language Processing (NLP) was a particularly interesting area. NLP enables machines to understand and generate human language, a huge leap from the type-safe code I’m used to in Java. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Models and Data&lt;/strong&gt;&lt;br&gt;
I learned that an ML model is essentially a function that transforms input into output by learning from data. A key takeaway was the difference between labeled and unlabeled data. While labeled data comes with predefined answers (like data for classification tasks), unlabeled data is used for self-supervised learning. This concept was a refreshing contrast to the deterministic behavior of traditional Java programs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Part 2: Tokens, Embeddings, and Transformers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once I had the fundamentals in place, I began exploring the inner workings of language models — a natural progression given my newfound interest in NLP.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tokens and Embeddings&lt;/strong&gt;&lt;br&gt;
I discovered that before any text can be processed by a machine, it must be broken down into small units called tokens. Think of it as parsing a sentence in Java — each token is like a word or subword, a manageable piece of data. These tokens are then transformed into embeddings, which are numerical representations in a high-dimensional space. In simpler terms, embeddings capture the essence or meaning of a word, allowing the model to understand relationships between words — much like how data structures in Java can represent complex relationships in code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Transformers and Attention&lt;/strong&gt;&lt;br&gt;
The next major breakthrough was understanding transformers. Unlike older models that processed text sequentially, transformers look at an entire sentence at once, using something called the attention mechanism. This allows the model to weigh the importance of each word relative to others, ensuring context is preserved. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A High-Level Look at Consuming LLMs via APIs&lt;/strong&gt;&lt;br&gt;
Finally, I learned that you don’t always need to build these models from scratch. Many companies now offer powerful LLMs through APIs. As a developer, this means you can integrate cutting-edge AI capabilities into your projects without dealing with the heavy lifting of training and maintaining the models yourself. It’s a bit like using a trusted Java library — someone else has done the hard work, and you just plug it into your application.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’m excited about where this exploration will lead next, especially as I start experimenting with more hands-on approaches and practical applications.&lt;/p&gt;

&lt;p&gt;Stay tuned for more updates!&lt;/p&gt;

&lt;p&gt;If you’re curious about these topics or have insights from your own experiences, I’d love to hear from you.&lt;/p&gt;

&lt;p&gt;Happy coding and exploring!&lt;/p&gt;

</description>
      <category>java</category>
      <category>machinelearning</category>
      <category>ai</category>
      <category>programming</category>
    </item>
    <item>
      <title>Spring Security For Beginners — Part 2</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Mon, 30 Sep 2024 11:52:05 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/spring-security-for-beginners-part-2-4e9</link>
      <guid>https://dev.to/therealdumbprogrammer/spring-security-for-beginners-part-2-4e9</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;How to secure a Spring Boot REST API with HTTP Basic Authentication&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/d1pw2FUnxgs"&gt;
&lt;/iframe&gt;
&lt;br&gt;
HTTP Basic is one of the simplest authentication mechanisms available. It’s also likely the first one people learn and try when getting started with Spring Security. This method is easier to understand because most of us are already familiar with username/password-based authentication.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In this article, we will explore how to implement it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Where do we start and what do we need?
&lt;/h2&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%2Fkwxtqf6dgj5fdlsp3uqu.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%2Fkwxtqf6dgj5fdlsp3uqu.png" alt="HTTP Basic Authentication" width="800" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In projects like this, we need at least two key components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A User Store&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;An Authentication Mechanism&lt;/strong&gt;, i.e., a way to compare and validate user credentials with what we already have in our system.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let’s break down the different components we’ll need and how we plan to implement them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;User Store&lt;/strong&gt;&lt;br&gt;
A user store is essentially an entity where we store user information, such as credentials. This could be an RDBMS, NoSQL database, or any third-party solution. In our case, we’ll use our own MySQL database, which will have a Users table.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;UserService and UserController&lt;/strong&gt;&lt;br&gt;
The UserController will have a registerUser endpoint, which users will call to register themselves.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;UserController will call UserService.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UserService will interact with UserRepository (a simple Spring Data repository) to insert new users or fetch existing user details from the MySQL database.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. PasswordEncoder&lt;/strong&gt;&lt;br&gt;
UserService will use a PasswordEncoder bean to encode passwords before creating a new user, ensuring that passwords are stored in a hashed form rather than as plain text in the database.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This encoder will also be used by Spring Security during authentication, where the framework will match the incoming raw password with the hashed password stored in the database.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. UserDetailsService&lt;/strong&gt;&lt;br&gt;
Since we can have various types of user stores, how does Spring know where to find and load a user? The UserDetailsService interface defines a contract for this purpose. If Spring finds an implementation of this service, it will be used to load the user during the authentication flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. UserDetails&lt;/strong&gt;&lt;br&gt;
Each product or project may represent users differently. To maintain consistency, Spring Security requires an instance of UserDetails, which represents the principal (the user being authenticated).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. SecurityFilterChain&lt;/strong&gt;&lt;br&gt;
This is a bean that we’ll define to configure the security settings in our project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. A Private Endpoint&lt;/strong&gt;&lt;br&gt;
We’ll implement a simple controller that will serve as a private endpoint, accessible only to authenticated users.&lt;/p&gt;

&lt;h2&gt;
  
  
  High Level Flow
&lt;/h2&gt;

&lt;p&gt;Here’s the high-level flow of our demo app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The user accesses the public registration endpoint to register.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The user provides a username, password, and email in the POST request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Since this is a public endpoint, Spring Security will not authenticate the request and will pass it on to the UserController.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UserController calls UserService.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UserService maps the incoming request to a JPA entity, uses the PasswordEncoder to hash the password, and then calls UserRepository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UserRepository.save(..) stores the user in the database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The user then accesses a private endpoint by passing their username and password through Postman or any other tool.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The user sets the authentication type to &lt;strong&gt;Basic Auth&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Spring Security looks for an implementation of UserDetailsService and calls its loadUserByUsername() method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The UserDetailsService implementation fetches the user from the database and creates an instance of UserDetails, representing the authenticated user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Spring Security automatically compares the raw password (entered by the user) with the hashed password (retrieved from the database).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the passwords match, the user is authenticated, and a 200 OK response is returned.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If they do not match, a 401 Unauthorized error is returned to the client.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Implemetation
&lt;/h2&gt;

&lt;p&gt;Now that we understand the building blocks, the implementation will be easy to follow. You can find it here — &lt;a href="https://github.com/therealdumbprogrammer/spring-security-httpbasic-auth/tree/master" rel="noopener noreferrer"&gt;https://github.com/therealdumbprogrammer/spring-security-httpbasic-auth/tree/master&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;For more details, please check out the YouTube tutorial linked above.&lt;br&gt;
If you enjoyed the content, don’t forget to like and share!&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>java</category>
      <category>springsecurity</category>
      <category>springboot</category>
      <category>programming</category>
    </item>
    <item>
      <title>Spring Security For Beginners — Part 1</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Tue, 10 Sep 2024 14:53:48 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/spring-security-for-beginners-part-1-4ki7</link>
      <guid>https://dev.to/therealdumbprogrammer/spring-security-for-beginners-part-1-4ki7</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/eG8caAniBrA"&gt;
&lt;/iframe&gt;
&lt;br&gt;
If you’re like me— struggling with Spring Security — how to start or where to start then this is the right place for you.&lt;/p&gt;

&lt;p&gt;I’ve been learning and experimenting with Spring Security and I will be sharing my learnings in a step-by-step manner with all of you who are in the same boat.&lt;/p&gt;

&lt;p&gt;In this post, we’ll start with the first step i.e. the Spring Security architecture on a high level.&lt;/p&gt;

&lt;p&gt;I’ll walk you through the architecture of Spring Security, breaking down its core components like the &lt;strong&gt;Security Filter Chain&lt;/strong&gt;, &lt;strong&gt;AuthenticationManager&lt;/strong&gt;, &lt;strong&gt;ProviderManager&lt;/strong&gt;, and more. This will give you a strong conceptual foundation to understand how Spring Security works under the hood.&lt;/p&gt;

&lt;h2&gt;
  
  
  Filters
&lt;/h2&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%2F0wtw54k8724afbz5y6r6.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%2F0wtw54k8724afbz5y6r6.png" alt="Filters" width="346" height="621"&gt;&lt;/a&gt;&lt;br&gt;
Filters are an essential part of any Java-based web application.&lt;/p&gt;

&lt;p&gt;In a typical web app, filters handle tasks such as logging, authentication, encoding, and more. The request moves through each filter in sequence, and on the way back, it goes through them again(but in reverse order).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The role of any filter is to intercept the incoming request, optionally do some operation, pass it to the next filter in the chain.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Spring Security
&lt;/h2&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%2F8v0q0mrvx890vkm8pf4u.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%2F8v0q0mrvx890vkm8pf4u.png" alt="Spring Security architecture" width="800" height="342"&gt;&lt;/a&gt;&lt;br&gt;
Let’s break down the architecture and understand the key components.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Security Filter Chain
&lt;/h2&gt;

&lt;p&gt;At the core of Spring Security lies its &lt;strong&gt;SecurityFilterChain&lt;/strong&gt;. This is a specialized filter chain(has a series of security related filters) that handles all the security logic in your application.&lt;/p&gt;

&lt;p&gt;When a request hits your application, it enters the SecurityFilterChain and passes through a series of filters designed to handle various security aspects like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Authentication&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Authorization&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Session management&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Exception handling&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s how it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inbound Requests&lt;/strong&gt;: When a request is received, it passes through multiple filters that perform tasks such as checking if the user is authenticated, authorizing access to resources, and managing sessions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security Filters&lt;/strong&gt;: Some of the key filters include UsernamePasswordAuthenticationFilter (handles authentication via username and password), BasicAuthenticationFilter (for HTTP Basic authentication), and ExceptionTranslationFilter (handles security-related exceptions).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Outbound Responses&lt;/strong&gt;: Once the request is processed and a response is generated, it travels back through the filters, ensuring that the response is secure before it reaches the client.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  2. AuthenticationManager and ProviderManager
&lt;/h2&gt;

&lt;p&gt;Once a request reaches the &lt;strong&gt;Security Filter Chain&lt;/strong&gt;, it is passed to the &lt;strong&gt;AuthenticationManager&lt;/strong&gt;. The AuthenticationManager is responsible for managing the authentication process, but it doesn’t directly authenticate the user. Instead, it delegates that task to &lt;strong&gt;ProviderManager&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;ProviderManager&lt;/strong&gt; is a collection of &lt;strong&gt;AuthenticationProviders&lt;/strong&gt;, each responsible for authenticating users through different methods. For instance, one provider might handle username-password authentication, while another could handle OAuth tokens.&lt;/p&gt;

&lt;p&gt;Here’s how the authentication flow works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ProviderManager&lt;/strong&gt; checks each provider to see if it can handle the current authentication method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the right provider is found, it processes the request and determines if the user is authenticated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If authentication is successful, the user is granted access; if not, an error is thrown.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  3. UserDetailsService and PasswordEncoder
&lt;/h2&gt;

&lt;p&gt;These two components are usually used with username/password based authentication mechanism but good to cover here.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;UserDetailsService&lt;/strong&gt;: This defines an interface contract which has a key method to find/load a user by username otherwise Spring Security has no idea how to load a user and from where. We provide an implementation of this method in our application through which the service loads user details (such as username, password, and roles) from a data source, usually a database which is used for user/client authentication.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;PasswordEncoder&lt;/strong&gt;: Spring Security never stores plain-text passwords. Instead, it uses a &lt;strong&gt;PasswordEncoder&lt;/strong&gt; to hash passwords when they are saved and to validate them during login attempts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4.SecurityContextHolder and Authentication
&lt;/h2&gt;

&lt;p&gt;Once authentication is successful, the user’s details are stored in the &lt;strong&gt;SecurityContextHolder&lt;/strong&gt;. This is a global object that holds security-related information for the current session(following the ThreadLocal model), specifically the &lt;strong&gt;Authentication&lt;/strong&gt; object.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Authentication&lt;/strong&gt; object contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Principal&lt;/strong&gt;: This usually represents the authenticated user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Credentials&lt;/strong&gt;: Typically, this holds sensitive data like the password. Once authentication is complete, the credentials are cleared.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Authorities&lt;/strong&gt;: These are the roles or permissions granted to the user, used for authorization purposes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By storing this information in the SecurityContextHolder, Spring Security ensures that the user’s identity and roles are available throughout the application, allowing it to make authorization decisions as needed.&lt;/p&gt;

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

&lt;p&gt;Here’s a high-level summary of how a request is processed in a Spring Security-enabled application:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Request hits the SecurityFilterChain&lt;/strong&gt;: Filters handle various security tasks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AuthenticationManager delegates to ProviderManager&lt;/strong&gt;: Authentication providers are consulted to authenticate the user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;UserDetailsService and PasswordEncoder(optional)&lt;/strong&gt;: These are used to retrieve user information and verify credentials.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SecurityContextHolder stores authentication details&lt;/strong&gt;: The user’s authentication state is stored and available for future security checks.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This architecture ensures that all aspects of security — authentication, authorization, session management — are handled efficiently and in a modular way. You can add or customize filters, implement different authentication providers, and modify how user details are managed, all without breaking the security flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Spring Security’s architecture is powerful yet flexible, allowing you to secure web applications with ease. By understanding the core components like the &lt;strong&gt;SecurityFilterChain&lt;/strong&gt;, &lt;strong&gt;AuthenticationManager&lt;/strong&gt;, and &lt;strong&gt;ProviderManager&lt;/strong&gt;, you’ll be better equipped to configure and customize your security needs.&lt;/p&gt;

&lt;p&gt;In future posts, I’ll dive deeper into these individual components, showing how they can be customized and extended to fit different application requirements.&lt;/p&gt;

&lt;p&gt;Until then, keep experimenting, and don’t forget — security is not optional, it’s essential!&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>security</category>
      <category>springboot</category>
      <category>springsecurity</category>
      <category>java</category>
    </item>
    <item>
      <title>Making Spring Transactions Transparent with Detailed Logging</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Wed, 05 Jun 2024 14:42:39 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/making-spring-transactions-transparent-with-detailed-logging-1n69</link>
      <guid>https://dev.to/therealdumbprogrammer/making-spring-transactions-transparent-with-detailed-logging-1n69</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/riNWDhiv3fk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;While working on my latest video on Transactions, I found a very useful logging configuration. By enable/configuring these log levels, you can gain valuable insights into your application’s transaction flow.&lt;/p&gt;

&lt;p&gt;This makes Spring Boot to display detailed information related to Spring/JPA Transactions wherein you can see Transactions being created, joined, committed, and rolled back.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuring log levels&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s a quick look at how you can set up detailed logging in your Spring Boot application:&lt;/p&gt;

&lt;p&gt;Add these configurations to your application.yml file&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note — for application.properties just change the format of keys and corresponding values.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spring:
  datasource:
    username: root
    password: mysql@123!
    url: jdbc:mysql://localhost:3306/hibdemo
  jpa:
    show-sql: true
    hibernate:
      ddl-auto: create
logging:
  level:
    org.springframework.orm.jpa.JpaTransactionManager: debug
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice the last section where we’re setting the logging level.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This setting will provide detailed logs that include when transactions are created, committed, and rolled back. This makes it easier to follow the flow and understand what’s happening under the hood.&lt;/p&gt;

&lt;p&gt;Here’s how it would look like when you run the application:&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%2Fxlcx53uqss1tnjunl4rt.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%2Fxlcx53uqss1tnjunl4rt.png" alt="Application logs"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re interested in a more in-depth explanation, including practical examples and best practices, check out my detailed YouTube video on Spring Transactions. In the video, I cover everything you need to know about managing transactions in Spring Boot, from basic concepts to advanced settings.&lt;/p&gt;

&lt;p&gt;I hope this post helps you get a better grasp of Spring transactions and logging. If you have any questions or need further clarification, feel free to leave a comment below or reach out on social media.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>spring</category>
      <category>programming</category>
    </item>
    <item>
      <title>Java on Azure Part 1 — Developing a CRUD application with Spring Boot &amp; Azure MySQL</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Tue, 14 Nov 2023 16:08:02 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/java-on-azure-part-1-developing-a-crud-application-with-spring-boot-azure-mysql-f59</link>
      <guid>https://dev.to/therealdumbprogrammer/java-on-azure-part-1-developing-a-crud-application-with-spring-boot-azure-mysql-f59</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/-T4x4-eIMLA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  A) How do we develop a Spring Boot Application?
&lt;/h2&gt;

&lt;p&gt;Developing a simple CRUD application is quite easy, isn’t it!&lt;/p&gt;

&lt;p&gt;We start with Spring Initializer, include required dependencies e.g. Spring JDBC, Spring Data, or Spring JPA. And then we use Crud or Jpa Repositories to implement CRUD operations.&lt;/p&gt;

&lt;p&gt;In trivial cases, we don’t need to write any code at all as Spring Data repositories can generate required code at runtime.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you need a refresher, refer this playlist on Spring Data project &lt;a href="https://www.youtube.com/playlist?list=PLpxcSt9FGVVGq9vFTFdFVhz9-OEsqvPaj"&gt;https://www.youtube.com/playlist?list=PLpxcSt9FGVVGq9vFTFdFVhz9-OEsqvPaj&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  B) Okay, what about the database?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Given&lt;/strong&gt;&lt;br&gt;
Suppose, we have a relational database which is running on our local system. We’re familiar with different ways of running a database:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Download the executable and start the database server&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the database in a container e.g. a docker container&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use a managed service e.g. a database running on cloud&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While the top 2 are generally used to run databases on local, the last one is a purely managed service which means the database is not running on our local system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Then&lt;/strong&gt;&lt;br&gt;
We provide the database details to our Spring boot application via application.properties or application.yml&lt;/p&gt;

&lt;h2&gt;
  
  
  C) So, the important thing is…
&lt;/h2&gt;

&lt;p&gt;We need the database details where it’s running and that can be a connection string or details like host, port, database name, a URL.&lt;/p&gt;

&lt;h2&gt;
  
  
  D) What does it have to do with Azure MySQL?
&lt;/h2&gt;

&lt;p&gt;Before that, let’s quickly cover what is Azure MySQL?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Azure MySQL&lt;/strong&gt;&lt;br&gt;
Azure MySQL is an Azure offering for MySQL database. It is fully managed by Azure.&lt;/p&gt;

&lt;p&gt;Which means it belongs to the category of 3rd option in Section &lt;strong&gt;B above.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Here, the difference is that the database is running on Azure cloud instead of our local system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, a Spring Boot application can easily connect to this MySQL instance same as any other MySQL as long as we provide/configure a correct connection string that can locate the running database server.&lt;/p&gt;

&lt;h2&gt;
  
  
  E) Steps
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create/setup an Azure MySQL instance&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Spring Initializer to setup a new code base&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add required azure dependencies and starters&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get the connection string of Azure database&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Provide the datasource details(url, username, password) in application.properties file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the main class&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Happy learning!&lt;/p&gt;

</description>
      <category>java</category>
      <category>azure</category>
      <category>springboot</category>
      <category>programming</category>
    </item>
    <item>
      <title>Cloud Native with Spring Cloud: A Beginner’s Guide</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Sat, 04 Nov 2023 05:46:31 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/cloud-native-with-spring-cloud-a-beginners-guide-19nn</link>
      <guid>https://dev.to/therealdumbprogrammer/cloud-native-with-spring-cloud-a-beginners-guide-19nn</guid>
      <description>&lt;h2&gt;
  
  
  Cloud Native with Spring Cloud: A Beginner’s Guide
&lt;/h2&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/WiAR648E18Q"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Cloud Native
&lt;/h2&gt;

&lt;p&gt;Cloud native is a modern approach to building, deploying, and managing applications that leverage the full power and benefits of cloud computing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Emphasizes:&lt;/strong&gt; Containerization, microservices, CI/CD pipelines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Characteristics:&lt;/strong&gt; Highly scalable, resilient, adaptable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Utilizes:&lt;/strong&gt; Cloud services for auto-scaling, resource optimization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fosters:&lt;/strong&gt; Agility, rapid delivery, user experience enhancement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Design goal:&lt;/strong&gt; Thrive in the cloud’s flexibility and scalability.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to develop Cloud Native apps?
&lt;/h2&gt;

&lt;p&gt;There are different ways to build cloud native apps. It depends on the programming language and its ecosystem like supported frameworks and patterns.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The important point to understand here is that cloud native is an approach of building, deploying, and managing applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You follow a set of best practices and patterns to build such apps, implementation doesn’t matter much.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cloud native apps with Spring and Java
&lt;/h2&gt;

&lt;p&gt;That’s the subject of this guide — how to build cloud native Java apps?&lt;/p&gt;

&lt;p&gt;Spring is by far the most popular framework used to build modern Java applications.&lt;/p&gt;

&lt;p&gt;The good this about Spring ecosystem is that it’s modular — there are different projects to support different aspects of Java development and different problems.&lt;/p&gt;

&lt;p&gt;Spring Cloud is one such Project that itself is a home of many different projects.&lt;/p&gt;

&lt;p&gt;If you visit the Spring documentation, you can see a long list of Spring Cloud sub-projects to support various aspects of cloud native apps.&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%2Fe8e23ac5clzj3oydmy25.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%2Fe8e23ac5clzj3oydmy25.png" alt="Spring Cloud Landing Page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Spring Cloud?
&lt;/h2&gt;

&lt;p&gt;Spring Cloud is a toolkit and set of frameworks that makes it simpler to build, deploy, and manage cloud-native applications.&lt;/p&gt;

&lt;p&gt;It builds upon the widely used Spring Framework, providing a solid foundation for creating enterprise-grade applications.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Spring Cloud offers patterns and best practices for designing and implementing microservices architecture.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How to use Spring Cloud?
&lt;/h2&gt;

&lt;p&gt;The same way we use any other Spring project — add a particular dependency to your POM and that’s it! Spring boot is smart enough to auto configure that project accordingly and then we can use provided abstractions to implement logic.&lt;/p&gt;

&lt;p&gt;In the following section, we will see few core projects that I think everyone should know about.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Projects in Spring Cloud
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Spring Cloud Config
&lt;/h2&gt;

&lt;p&gt;Imagine having multiple instances of your application running in the cloud. Spring Cloud Config helps you manage configuration settings for these instances in a centralized and externalized manner.&lt;/p&gt;

&lt;p&gt;It allows you to store configurations in a Git repository or other external sources.&lt;/p&gt;

&lt;p&gt;This means you can alter configurations without needing to redeploy your application, enhancing flexibility and dynamism.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Efficiently handling environment-specific configurations (e.g., development, staging, production) in a distributed application.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Spring Cloud Netflix
&lt;/h2&gt;

&lt;p&gt;This project encompasses a suite of libraries that assist in implementing patterns commonly used in microservices architectures.&lt;/p&gt;

&lt;p&gt;It includes tools like Eureka for service registration and discovery.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Ensuring that your services can locate and communicate with one another in a dynamic and scalable environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Spring Cloud Stream
&lt;/h2&gt;

&lt;p&gt;Microservices often need to communicate with each other through messaging systems. Spring Cloud Stream offers a straightforward and consistent approach to constructing message-driven microservices.&lt;/p&gt;

&lt;p&gt;It supports various message brokers like RabbitMQ and Kafka, allowing you to focus on business logic instead of dealing with low-level messaging intricacies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Constructing event-driven applications where services need to respond to events and messages in real-time.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Spring Cloud Security
&lt;/h2&gt;

&lt;p&gt;Security is a paramount concern for any application, particularly in a distributed microservices environment.&lt;/p&gt;

&lt;p&gt;Spring Cloud Security equips you with tools and libraries to handle authentication and authorization in a microservices architecture.&lt;/p&gt;

&lt;p&gt;It integrates seamlessly with Spring Security, streamlining the process of securing your services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Implementing security measures to safeguard your microservices and thwart unauthorized access.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Spring Cloud Gateway
&lt;/h2&gt;

&lt;p&gt;Spring Cloud Gateway is a powerful tool for building API gateways in a microservices architecture.&lt;/p&gt;

&lt;p&gt;It provides a flexible and efficient way to route and filter HTTP requests to different services. With features like load balancing, rate limiting, and path-based routing, it helps optimize the flow of traffic between services.&lt;/p&gt;

&lt;p&gt;Additionally, it integrates seamlessly with Spring Cloud projects, making it a crucial component for managing and securing communication within a microservices ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Directing and controlling traffic to various services, ensuring efficient and secure communication in a microservices architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Spring Cloud OpenFeign
&lt;/h2&gt;

&lt;p&gt;Spring Cloud OpenFeign simplifies the process of making HTTP requests to other microservices in a microservices architecture.&lt;/p&gt;

&lt;p&gt;It allows developers to define interfaces with annotated methods, which are automatically implemented and wired to make HTTP requests.&lt;/p&gt;

&lt;p&gt;This eliminates the need for manual HTTP client code, making communication between services more straightforward and efficient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Streamlining communication between microservices, reducing boilerplate code for making HTTP requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Projects:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  - Spring Cloud Secure Vault
&lt;/h3&gt;

&lt;p&gt;Secure Vault provides a secure and centralized way to manage sensitive information such as passwords, API keys, and other credentials in your applications.&lt;/p&gt;

&lt;p&gt;It ensures that sensitive data is protected and easily accessible only to authorized services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Safeguarding critical credentials and sensitive information in a cloud-native application.&lt;/p&gt;

&lt;h3&gt;
  
  
  - Spring Cloud Function
&lt;/h3&gt;

&lt;p&gt;Spring Cloud Function simplifies the process of developing serverless functions using Spring.&lt;/p&gt;

&lt;p&gt;It allows you to write business logic as functions and deploy them to various serverless platforms like AWS Lambda, Azure Functions, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Creating and deploying serverless functions in a cloud environment, reducing operational overhead.&lt;/p&gt;

&lt;h3&gt;
  
  
  - Spring Cloud Circuit Breaker
&lt;/h3&gt;

&lt;p&gt;Circuit breakers are essential for building resilient microservices. Spring Cloud Circuit Breaker provides a set of abstractions and implementations for handling faults and failures in distributed systems. It helps prevent cascading failures and provides fallback mechanisms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Ensuring that your application gracefully handles failures and maintains stability, even when components are experiencing issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  A sample design
&lt;/h2&gt;

&lt;p&gt;Here’s a simple and basic design to help you understand different components and how we can implement them using Spring Cloud.&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%2Fn9gbw0piz0095fieplrk.jpg" 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%2Fn9gbw0piz0095fieplrk.jpg" alt="A sample design"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Spring Cloud is a powerful toolkit that simplifies the process of building and deploying cloud-native applications.&lt;/p&gt;

&lt;p&gt;By leveraging its key projects, including Spring Cloud Config, Netflix, Sleuth and Zipkin, Stream, and Security, along with additional tools like Secure Vault, Function, and Circuit Breaker, you can tackle common challenges in microservices development.&lt;/p&gt;

&lt;p&gt;With Spring Cloud, you’ll be well-equipped to create robust, scalable, and secure applications in the cloud.&lt;/p&gt;

&lt;p&gt;Remember, this is just the tip of the iceberg. As you delve deeper into Spring Cloud, you’ll uncover even more features and projects that can further enhance your microservices architecture.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you found this information helpful, be sure to follow for more insightful content on cloud-native development. Subscribe to stay updated with the latest tips and tricks in the world of technology.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>java</category>
      <category>cloud</category>
      <category>spring</category>
      <category>cloudnative</category>
    </item>
    <item>
      <title>Role of Service Discovery in Microservices</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Tue, 26 Sep 2023 14:53:12 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/role-of-service-discovery-in-microservices-3h0b</link>
      <guid>https://dev.to/therealdumbprogrammer/role-of-service-discovery-in-microservices-3h0b</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.youtube.com/watch?si=BIVRIQlK7sgGZF0n&amp;amp;v=jbDvU6ce-a8&amp;amp;feature=youtu.be" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--JBVLYXZn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.ytimg.com/vi/jbDvU6ce-a8/maxresdefault.jpg" height="450" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.youtube.com/watch?si=BIVRIQlK7sgGZF0n&amp;amp;v=jbDvU6ce-a8&amp;amp;feature=youtu.be" rel="noopener noreferrer" class="c-link"&gt;
          Mastering Service Discovery for Seamless Microservices Integration - YouTube
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Different ways to implement Service Discovery:1) Using Spring Cloud Netflix EurekaEureka Server - https://youtu.be/wTjnFzs8rBcEureka Client - https://youtu.b...
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--KaHzNaEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.youtube.com/s/desktop/66e817d4/img/favicon.ico" width="16" height="16"&gt;
        youtube.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;In Microservices architecture, we have different services instead of a monolithic application/service. On top of that, each service would have multiple instances.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We used to have one application but now we have several applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZSXYfm3n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r31hlemjv5xsym02vo7d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZSXYfm3n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r31hlemjv5xsym02vo7d.png" alt="Breaking Monilith" width="800" height="617"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  So, what’s the problem here?
&lt;/h2&gt;

&lt;p&gt;As people say — all kind of things will go wrong as soon as you go from one instance to multiple instances.&lt;/p&gt;

&lt;p&gt;Your application would have an address i.e. where to find it, how to connect to it. So, for instance, an IP and a port. Let’s say your application’s address is — &lt;a href="http://someip/abc"&gt;http://someip/abc&lt;/a&gt; and it internally uses port 8081.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When there’s a single application — you and the clients(client apps) know where it’s running.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A client app can use this IP and Port information to talk to your application.&lt;/p&gt;

&lt;p&gt;Consider we add another instance of the same application. Now, we can’t run the new instance with the same port on the same host due to port conflicts, there are other ways to solve this problem.&lt;/p&gt;

&lt;p&gt;Also, now we have to keep this information somewhere that this application has two instances and what are the addresses of these instances.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if the instance goes down?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If an instance goes down, we need to remove it and add a new one. But, we also need to update the information(wherever we kept earlier) i.e. remove the crashed instance’s metadata and add the details of newly created instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if we scale up and down?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What if we scale up to 100 instances and down to 1 when not required? How to keep the metadata updated for all created and destroyed instances?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does the client know which instance to call?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;How do we redirect the client calls in load balanced way? How does the client find the correct address of an instance to call the application?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E9poUMl8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yzxlij1qd5gil4tl53av.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E9poUMl8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yzxlij1qd5gil4tl53av.png" alt="How does a client find the right instance?" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;You got it right, this is not going to be an easy task in a Microservices architecture!&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s see how a Service Discovery solution can solve these problems..&lt;/p&gt;

&lt;h2&gt;
  
  
  Service Discovery
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Service discovery is the process of automatically detecting devices and services on a computer network. This reduces the need for manual configuration by users and administrators. — Wikipedia&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is generally a two step process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Registration&lt;/strong&gt;— In this step, services(or their instances) register themselves with the Service Discovery when they’re coming up.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Discovery&lt;/strong&gt;— Once the discovery service has the metadata about registered services, clients or other services can query the discovery service to find the required information about other services&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7xRBKsq4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9dxri5g50gt80vocasvm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7xRBKsq4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9dxri5g50gt80vocasvm.png" alt="A simple view of a Discovery Service" width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Problems addressed by Service Discovery
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Registering and de-registering Services&lt;/strong&gt; — As discussed above, services can register themselves with the discovery service. In the same way, a particular instance of a Service can be deregistered as well in case of a crash or server failure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monitoring&lt;/strong&gt; — Discovery service can monitor registered service so it knows what’s the status of different services and their instances. This information is useful in scaling and load balancing scenarios.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Locating Services&lt;/strong&gt; — With the help of discovery service, clients(could be different services) can locate other services without knowing explicit host, port, or IP.&lt;/p&gt;

&lt;h2&gt;
  
  
  Different Service Discovery Solutions
&lt;/h2&gt;

&lt;p&gt;There are different ways to implement a service discovery solution, to name a few:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Netflix Eureka&lt;/strong&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.youtube.com/watch?si=meiG77X-wzKmRmj6&amp;amp;v=wTjnFzs8rBc&amp;amp;feature=youtu.be" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--jZztu2Dw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.ytimg.com/vi/wTjnFzs8rBc/maxresdefault.jpg" height="450" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.youtube.com/watch?si=meiG77X-wzKmRmj6&amp;amp;v=wTjnFzs8rBc&amp;amp;feature=youtu.be" rel="noopener noreferrer" class="c-link"&gt;
          Spring Cloud Eureka Server | Microservices | Developer's Guide - YouTube
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          GitHub Repository - https://github.com/therealdumbprogrammer/spring-cloud-netflix-eureka-serverIn this video, we're going to be exploring the Spring Cloud Eu...
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--KaHzNaEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.youtube.com/s/desktop/66e817d4/img/favicon.ico" width="16" height="16"&gt;
        youtube.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.youtube.com/watch?si=vzFT6JYUsSTMLIJm&amp;amp;v=clBKsG_kpVs&amp;amp;feature=youtu.be" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--4AkzAjNf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.ytimg.com/vi/clBKsG_kpVs/maxresdefault.jpg" height="450" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.youtube.com/watch?si=vzFT6JYUsSTMLIJm&amp;amp;v=clBKsG_kpVs&amp;amp;feature=youtu.be" rel="noopener noreferrer" class="c-link"&gt;
          Spring Cloud Netflix Eureka Client | Microservices | Developer's Guide - YouTube
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          GitHub Repository - https://github.com/therealdumbprogrammer/spring-cloud-netflix-eureka-clientToday we're going to take a look at how to master the Netflix ...
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--KaHzNaEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.youtube.com/s/desktop/66e817d4/img/favicon.ico" width="16" height="16"&gt;
        youtube.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;strong&gt;2. Consul&lt;/strong&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.youtube.com/watch?si=Ea0bebOLwHD7L2AL&amp;amp;v=2INO3NYKqZk&amp;amp;feature=youtu.be" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nssz3TEc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.ytimg.com/vi/2INO3NYKqZk/maxresdefault.jpg" height="450" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.youtube.com/watch?si=Ea0bebOLwHD7L2AL&amp;amp;v=2INO3NYKqZk&amp;amp;feature=youtu.be" rel="noopener noreferrer" class="c-link"&gt;
          Spring Cloud Consul Service Discovery | Microservices - YouTube
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          GitHub Repository - https://github.com/therealdumbprogrammer/spring-cloud-consul-discovery-clientIn this video, we'll be taking a look at the Spring Cloud Co...
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--KaHzNaEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.youtube.com/s/desktop/66e817d4/img/favicon.ico" width="16" height="16"&gt;
        youtube.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;strong&gt;3. Zookeeper&lt;/strong&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.youtube.com/watch?si=tp1aNZH47HEpW676&amp;amp;v=1zyGkjHLeCo&amp;amp;feature=youtu.be" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--xCwEzjkx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.ytimg.com/vi/1zyGkjHLeCo/maxresdefault.jpg" height="450" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.youtube.com/watch?si=tp1aNZH47HEpW676&amp;amp;v=1zyGkjHLeCo&amp;amp;feature=youtu.be" rel="noopener noreferrer" class="c-link"&gt;
          Service Discovery using Spring Cloud Zookeeper | Microservices | Developer's Guide - YouTube
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          GitHub Repository - https://github.com/therealdumbprogrammer/spring-zookeeper-discovery-clientIn this video, we're going to show you how to use Spring Cloud ...
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--KaHzNaEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.youtube.com/s/desktop/66e817d4/img/favicon.ico" width="16" height="16"&gt;
        youtube.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;strong&gt;4. Kubernetes supported discovery service&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Happy Learning!!&lt;/p&gt;

</description>
      <category>programming</category>
      <category>microservices</category>
      <category>java</category>
      <category>springboot</category>
    </item>
    <item>
      <title>Building a REST API using Spring Boot | Step-by-Step Plan</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Wed, 30 Aug 2023 14:08:40 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/building-a-rest-api-using-spring-boot-step-by-step-plan-4h1</link>
      <guid>https://dev.to/therealdumbprogrammer/building-a-rest-api-using-spring-boot-step-by-step-plan-4h1</guid>
      <description>&lt;p&gt;Hey Guys, I’m back again with another step-by-step plan.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you are interested in or planning to learn Spring Data, please check out my previous article &lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/therealdumbprogrammer" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F1039737%2F40cc3d30-7613-4ce1-8f9f-b62fd9a695e2.png" alt="therealdumbprogrammer"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/therealdumbprogrammer/mastering-spring-data-a-step-by-step-plan-with-free-course-links-47cc" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Mastering Spring Data — A Step-by-Step Plan with free course Links&lt;/h2&gt;
      &lt;h3&gt;TheCodeAlchemist ・ Aug 12 '23&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#java&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#spring&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#springboot&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#programming&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;If you’re in hurry, jump right on to the playlist:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/A86pk2n-u9I"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  APIs are everywhere!
&lt;/h2&gt;

&lt;p&gt;APIs are everywhere. Everything is moving towards &lt;strong&gt;X-as-a-Service.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So, either you own an API or you’re consuming an API.&lt;/p&gt;

&lt;p&gt;While there are a few solutions available e.g. GraphQL, gRPC, REST is still one of the most popular solutions available.&lt;/p&gt;

&lt;p&gt;And, extend this to Java — again, there are different ways to develop an API but Spring Boot is the most widely used framework to develop an API.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you’re a beginner or just want to brush-up the basics then you’re at the right place.&lt;br&gt;
 In this article, we will cover the basic knowledge of Spring Boot API. By the end of this article, you’ll be able to write your own API.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There is too much to learn and explore in Microservices area. Building an API is probably the first step.&lt;/p&gt;

&lt;p&gt;To start, this is the bare minimum that we need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;A Spring Boot Project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to handle and process the request?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to read and consume parameters or data from the incoming request?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to return a good Response?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to handle the exceptions and errors?&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step-1 [@RestController]
&lt;/h2&gt;

&lt;p&gt;To start, we need to step a Spring Boot Project and we need to add right set of dependencies.&lt;/p&gt;

&lt;p&gt;Once we have the project, the next thing is how to handle and process the request?&lt;/p&gt;

&lt;p&gt;Well, we create a Controller. What’s a Controller?&lt;/p&gt;

&lt;p&gt;Controller is a Java class which is annotated with @RestController annotation. This annotation tells Spring that this class is capable of handling the incoming requests.&lt;/p&gt;

&lt;p&gt;Having a RestController is not enough. It will intercept the request but what to do after that?&lt;/p&gt;

&lt;p&gt;To process the request, we need a method in the controller class. And, to invoke that method, we need another annotation to bind it with the incoming request’s HTTP method type. For instance, if this is an HTTP Get request, then we need to annotate the method with @GetMapping.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/A86pk2n-u9I"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-2 [@RequestMapping]
&lt;/h2&gt;

&lt;p&gt;You must have seen the URLs in API calls. How does an API translate and map these URLs to the Controllers we created in Step-1?&lt;/p&gt;

&lt;p&gt;There’s another annotation — @RequestMapping. With this annotation, we define URL patterns for Controllers and method which will decide which controller and method to invoke in order to process a request.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/OhRstcHvIM4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-3 [@RequestParam &amp;amp; @PathVariable]
&lt;/h2&gt;

&lt;p&gt;Now, we need to make it dynamic. We need to be able to consume data/parameters from the incoming requests.&lt;/p&gt;

&lt;p&gt;There are different ways to pass the data in a request, request parameter and path variable being the most common ones.&lt;/p&gt;

&lt;p&gt;Learn here how to use @RequestParam and @PathVariable annotations.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/TJG-LTLZo5s"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/BVRRfmBHKSU"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-4 [@PostMapping &amp;amp; @RequestBody]
&lt;/h2&gt;

&lt;p&gt;Now, we’re making some progress. Our API is getting some shape now.&lt;/p&gt;

&lt;p&gt;Let’s see how to create the resources and how to process HTTP Post requests.&lt;/p&gt;

&lt;p&gt;We use @PostMapping to do this.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/vHEGlrPTFdc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-5 [@ResponseEntity]
&lt;/h2&gt;

&lt;p&gt;It’s not a mandatory but a good-to-know thing.&lt;/p&gt;

&lt;p&gt;@ResponseEntity gives us the flexibility to have more control over the response we’re returning.&lt;/p&gt;

&lt;p&gt;Here’s a quick demo on the same.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/qo56g2PlS5o"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-6 [@ControllerAdvice &amp;amp; @ExceptionHandler]
&lt;/h2&gt;

&lt;p&gt;All good? No? What we should we do then?&lt;/p&gt;

&lt;p&gt;Yea, what should we do when it’s not all good? How to handle errors and exceptions gracefully?&lt;/p&gt;

&lt;p&gt;We not only want to handle the abnormal situations but we want to report them in a clean meaningful way so that client can make a sense out of it and decide what to do accordingly.&lt;/p&gt;

&lt;p&gt;@ControllerAdvice and @ExceptionHandler annotations provide a way to handle the exceptions and return an error response in a clean and consistent way.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/kzfQvtOu-JI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  You’re mostly ready!
&lt;/h2&gt;

&lt;p&gt;Not kidding, you ARE!&lt;/p&gt;

&lt;p&gt;These are the building blocks. If you’re comfortable with these concepts and annotations, believe me, you’re ready to develop a REST API of your own using Spring Boot.&lt;/p&gt;

&lt;p&gt;There are other things like Security, discovery, HATEOAS that we have not covered but this is not an exhaustive guide.&lt;/p&gt;

&lt;p&gt;Once you feel comfortable, the last step is to develop a demo API.&lt;/p&gt;

&lt;p&gt;Need any help? Watch this video which covers a Demo API with MySQL DB connectivity using Spring Data JPA.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/uHqzGXR8Uqs"&gt;
&lt;/iframe&gt;
&lt;br&gt;
Happy Learning!&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>java</category>
      <category>springboot</category>
      <category>programming</category>
    </item>
    <item>
      <title>Mastering Spring Data — A Step-by-Step Plan with free course Links</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Sat, 12 Aug 2023 12:29:23 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/mastering-spring-data-a-step-by-step-plan-with-free-course-links-47cc</link>
      <guid>https://dev.to/therealdumbprogrammer/mastering-spring-data-a-step-by-step-plan-with-free-course-links-47cc</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;If you’re unsure where to start, start from here:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.youtube.com/playlist?list=PLpxcSt9FGVVGq9vFTFdFVhz9-OEsqvPaj" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ytimg.com%2Fvi%2Fu5EM93DLin0%2Fhqdefault.jpg%3Fsqp%3D-oaymwEXCOADEI4CSFryq4qpAwkIARUAAIhCGAE%3D%26rs%3DAOn4CLBTUaw8Nbks9ZjgRQOHSKgYSNifDQ%26days_since_epoch%3D20005" height="auto" class="m-0"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.youtube.com/playlist?list=PLpxcSt9FGVVGq9vFTFdFVhz9-OEsqvPaj" rel="noopener noreferrer" class="c-link"&gt;
          spring-data - YouTube
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          All about Java and database connectivity
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.youtube.com%2Fs%2Fdesktop%2Ffcb15d92%2Fimg%2Ffavicon.ico"&gt;
        youtube.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;/h2&gt;

&lt;p&gt;Data is everywhere. Almost every application or system we design and develop has something to do with data. &lt;/p&gt;

&lt;p&gt;It’s either generating new data sets OR ingesting data from some other system OR processing and transforming data so that some other application can do something based on what it consumes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In a nutshell — it’s all about the data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;On top of that, there are variety of data stores e.g. RDBMS, NoSQL, Caches, Distributed Caches, Time-series DBs and the list goes on….&lt;/p&gt;

&lt;p&gt;Data management is so critical that it’s an essential skill for developers.&lt;/p&gt;

&lt;p&gt;It’s important that we know how to write data to a database and read from the database.&lt;/p&gt;

&lt;p&gt;And, it’s not a simple thing — consider available options like JDBC, JPA, Hibernate, Spring JDBC, Spring Data JPA, and so on. It can become messy and very confusing, especially for beginners.&lt;/p&gt;

&lt;p&gt;So, in this step-by-step guide, we will see how you can start from the basics and master database connectivity in Java.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-0 Learn JDBC Concepts
&lt;/h2&gt;

&lt;p&gt;JDBC is a pretty low level API but it’s still the first thing you should familiarize yourself with. Since we don’t generally write raw JDBC code nowadays so you can avoid going into the deep from a beginner’s perspective. You can simply focus on the basics. Complete this free Oracle JDBC lesson to understand the building blocks of database connectivity in Java.&lt;br&gt;
&lt;a href="https://docs.oracle.com/javase/tutorial/jdbc/basics/index.html" rel="noopener noreferrer"&gt;&lt;strong&gt;Lesson: JDBC Basics&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Time to fly! Moving on to Spring Framework
&lt;/h2&gt;

&lt;p&gt;Once you’re comfortable with JDBC, the next step is to pick Spring Framework. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As of today, at the time of writing this article, you can’t succeed in your developer career if you don’t have hands-on experience on Spring Framework and related Spring projects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And, this is mostly true as majority of enterprise applications are built on top of Spring stack. &lt;/p&gt;

&lt;p&gt;If you simply visit the Spring homepage and explore Spring Data section, you’d see a long list of supported connectors and APIs.&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%2F51qa5iu1mqnfuj5tfokd.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%2F51qa5iu1mqnfuj5tfokd.png" alt="Spring Data Family"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even if you can’t cover everything from the above list, couple of child projects which you should absolutely explore are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Spring JDBC&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Spring Data JPA&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Spring Data for Cassandra&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Step-1 Spring Data JDBC
&lt;/h2&gt;

&lt;p&gt;If you completed Step-0, you’d really appreciate Spring Data JDBC. &lt;/p&gt;

&lt;p&gt;Spring Data JDBC is a wrapper around JDBC which simplifies JDBC connectivity. Spring JDBC is a perfect choice if your project is really simple and doesn’t really need complex ORM features.&lt;/p&gt;

&lt;p&gt;You can start from here:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/zjYCOBynhY0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Then, move on to Spring Boot and learn how Spring Boot can further simplify Spring JDBC in a project.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/l35K3W_v3Vw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-2 Spring Data JPA
&lt;/h2&gt;

&lt;p&gt;Spring JDBC is all good but it really falls short when a project needs ORM features and has complex entity models and entity relationships.&lt;/p&gt;

&lt;p&gt;Spring Data JPA uses Hibernate under the hood and simplifies entity mappings, data access with Repositories, pagination, filtering, etc.&lt;/p&gt;

&lt;p&gt;Start from here:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/lyQsBU7E9Lo"&gt;
&lt;/iframe&gt;
&lt;br&gt;
Learn how to read data from the database using Data JPA.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/kx0eKDIsyx4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Next, understand how to implement Pagination and Sorting using Spring Data JPA.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/rous9SCn_MA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;And, lastly how to perform search operation without writing much code using Spring code generation and Data repositories.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/z__lSUG-x_0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;If you cover this much, you’d be pretty comfortable with JPA and can explore more features on your own e.g. native queries, caching, fetch plans, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-3 Spring Data Redis
&lt;/h2&gt;

&lt;p&gt;Spring Data Redis is not needed for typical CRUD based applications. It has nothing to do with RDBMS data stores.&lt;/p&gt;

&lt;p&gt;The main use-case of Redis is to use it as a high performance distributed cache.&lt;/p&gt;

&lt;p&gt;Learning Spring Data Redis would expand your horizon as a developer as you learn more about capabilities of Spring Data and it easily integrates with similar NoSQL technologies and frameworks.&lt;/p&gt;

&lt;p&gt;Even if you’re not working on Redis or similar solutions, I would still recommend to learn a little bit about Spring and Redis integration.&lt;/p&gt;

&lt;p&gt;Follow this 3 part step-by-step playlist:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Bh4mGFeRUhg"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/aw8UATAuGYQ"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/pCsNUDqamWk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-4 Spring Data for Apache Cassandra
&lt;/h2&gt;

&lt;p&gt;Apache Cassandra is an extremely popular NoSQL database which is heavily used in high performant distributed solutions.&lt;/p&gt;

&lt;p&gt;Spring Data for Apache Cassandra is a Spring Data project which focuses on Cassandra integration and how easily you can setup a Java project that uses a Cassandra cluster.&lt;/p&gt;

&lt;p&gt;This is also a 3 part series which will take you through the world of NoSQL world.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/pYmuJIejOcs"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/KYbxYQBqWPc"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/3PrrLD4qDDg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;If you covered this much, I’m pretty sure you’d feel ultra comfortable with any Spring based data project.&lt;/p&gt;

&lt;p&gt;BUT…don’t just stop here. Keep exploring and don’t forget to subscribe so you don’t miss any future updates.&lt;/p&gt;

&lt;p&gt;Happy learning!&lt;/p&gt;

</description>
      <category>java</category>
      <category>spring</category>
      <category>springboot</category>
      <category>programming</category>
    </item>
    <item>
      <title>Spring JDBC Quick Refresher</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Sat, 08 Jul 2023 07:14:10 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/spring-jdbc-quick-refresher-3fmg</link>
      <guid>https://dev.to/therealdumbprogrammer/spring-jdbc-quick-refresher-3fmg</guid>
      <description>&lt;p&gt;Database connectivity is one of the most important aspects of any application. After all, we need a persistent system to store the data.&lt;/p&gt;

&lt;p&gt;Storing the data is not enough, the application needs to perform other actions as well e.g. reading, deleting, and updating the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up the database
&lt;/h2&gt;

&lt;p&gt;The very first thing is to setup a database. To do that, we need to finalize a data store. There are many options available in the market and it depends on the use case.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;RDBMS — MySQL, Postgress, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NoSQL — Cassandra, Couchbase, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Document DB — MongoDB&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Graph DB — Neo4J&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cloud DBs — Azure Cosmos DB or similar offerings from AWS and GCP&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After finalizing the database, next step would be to install and setup it.&lt;/p&gt;

&lt;p&gt;On your local, you’d have to do it on your own.&lt;/p&gt;

&lt;p&gt;For instance — here we install MySQL on a Windows machine.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/xlDLc4pHyvo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting to the database
&lt;/h2&gt;

&lt;p&gt;To connect, an application needs to know few basic properties like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;DB URL or connection String — which tells where it can find the running database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Database driver — Each database has a driver that acts as an intermediary layer between application and the real database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Credentials — it could be username and password, an access token, or some kind of access key.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Database API
&lt;/h2&gt;

&lt;p&gt;This is probably the most important aspect of DB connectivity. How exactly an application would talk to a database. We need a high level database API, compatible with the programming language, and the database.&lt;/p&gt;

&lt;h2&gt;
  
  
  JDBC
&lt;/h2&gt;

&lt;p&gt;JDBC or Java Database Connectivity is the core API shipped with JDK which allows Java applications to talk to different databases without worrying about low level details of database connectivity.&lt;/p&gt;

&lt;p&gt;In general, an application does following things in order to interact with database:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Load the database driver — happens automatically in newer versions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create/get a data source — a wrapper representing the underlying data store.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Establish the connection&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create the statement objects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Execute CRUD queries&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Handle the ResultSet if/when query returns the results&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Handle exceptions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Closing statement&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Closing/releasing the connection&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As you can see, it looks a bit complicated.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;And that’s where Spring JDBC comes into the picture.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Spring JDBC
&lt;/h2&gt;

&lt;p&gt;Spring JDBC is a part of overall Spring Data project. It is suitable for simple JDBC operations where an application doesn’t need ORM/JPA capabilities.&lt;/p&gt;

&lt;p&gt;Spring JDBC simplifies the aforementioned JDBC steps. It leverages Spring Framework capabilities like IoC, loosely coupled components which allow a developer to focus on the business logic.&lt;/p&gt;

&lt;p&gt;Spring JDBC handles the connection, statements, releasing them, and handling common runtime exceptions.&lt;/p&gt;

&lt;h2&gt;
  
  
  When would we use Spring JDBC?
&lt;/h2&gt;

&lt;p&gt;There are quite a few options in Java space when it comes to the DB connectivity.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Using plain JDBC&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using native Hibernate&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using Spring JDBC&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using JPA with Hibernate as its implementation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using Spring Data JPA which uses Hibernate as JPA implementation same as above point but simplifies everything same as other Spring projects.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Options 4 and 5 are best suited for applications which have complex entity models and need ORM features.&lt;/p&gt;

&lt;p&gt;If your application doesn’t need these features but you still need a clean way to interact with database — choose Spring JDBC&lt;/p&gt;

&lt;h2&gt;
  
  
  Starting with Spring JDBC
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a maven project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add Spring JDBC dependency&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add Mysql(or your database specific) connector dependency&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create DataSource bean using DB properties like URL, driver-class, username, and password&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Autowire DataSource where you need it e.g. in DAO classes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In DAO class, initialize JdbcTemplate/NamedParamaterJdbcTemplate.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use template methods to query database.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;See this detailed video on how to work with Spring JDBC.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/zjYCOBynhY0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Spring JDBC with Spring Boot
&lt;/h2&gt;

&lt;p&gt;Spring Boot further simplifies Spring JDBC.&lt;/p&gt;

&lt;p&gt;When we use Spring Boot, we don’t need to create DataSource and JdbcTemplate/NamedParameterJdbcTemplate.&lt;/p&gt;

&lt;p&gt;We just need to provide following details in application.properties and include corresponding starter poms in pom.xml:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;spring.datasource.url&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;spring.datasource.username&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;spring.datasource.password&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Spring boot will automatically create DataSource and JdbcTemplate bean.&lt;/p&gt;

&lt;p&gt;In DAO classes, we simply need to autowire JdbcTemplate in order to use it.&lt;/p&gt;

&lt;p&gt;You can find all the details in this video:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/l35K3W_v3Vw"&gt;
&lt;/iframe&gt;
&lt;br&gt;
If you like the content, please share the content and subscribe my channel for similar content.&lt;/p&gt;

&lt;p&gt;Happy learning!&lt;/p&gt;

</description>
      <category>programming</category>
      <category>tutorial</category>
      <category>java</category>
      <category>springboot</category>
    </item>
    <item>
      <title>Spring Framework for Everyone</title>
      <dc:creator>TheCodeAlchemist</dc:creator>
      <pubDate>Sat, 24 Jun 2023 15:34:46 +0000</pubDate>
      <link>https://dev.to/therealdumbprogrammer/spring-framework-for-everyone-5258</link>
      <guid>https://dev.to/therealdumbprogrammer/spring-framework-for-everyone-5258</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Below YouTube playlist is a great place to start.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/OurfeLMrmv0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What is Spring?
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/OurfeLMrmv0"&gt;
&lt;/iframe&gt;
&lt;br&gt;
Spring is an open-source Java platform that enables to write maintainable and scalable Java applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What do we mean by ‘platform’?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Spring is a &lt;em&gt;complete ecosystem&lt;/em&gt; for Java applications. It’s not a single project but a collection of various projects under the umbrella of Spring and each project focuses on a certain aspect of Java development.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Modern Java development is so dependent on Spring projects that it’s really difficult to think about a non-spring application.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Where can I find the information on Spring?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can find everything about Spring here — &lt;a href="https://spring.io/"&gt;https://spring.io/&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What are Spring projects?
&lt;/h2&gt;

&lt;p&gt;Each Spring project is a framework in itself which helps developers to develop a certain kind of Java application. For instance, if you want to develop a web application, there’s a Spring project for that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where can I find these projects?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can find all the projects here &lt;a href="https://spring.io/projects/"&gt;https://spring.io/projects/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another view of the same is &lt;a href="https://spring.io/projects/spring-boot"&gt;https://spring.io/projects/spring-boot&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Spring Framework?
&lt;/h2&gt;

&lt;p&gt;While there are many projects, the core of everything is Spring core AKA Spring Framework which provides dependency injection features.&lt;/p&gt;
&lt;h2&gt;
  
  
  Dependency Injection(DI) &amp;amp; Inversion of Control(IoC)
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/phIA8MDZwSg"&gt;
&lt;/iframe&gt;
&lt;br&gt;
In a Java project, we generally write classes, define their dependencies, and create objects where required. If class A wants to use class B then we do something like this:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class A {
  public void something() {
    B = new B(); //creating the object manually using new keyword 
    B.dosomething();
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;In a nutshell, the program as it executes, creates such objects and link those objects to do what it’s supposed to do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spring uses DI&lt;/strong&gt; to inject the dependencies where required instead of us creating objects manually using new keyword. Spring can use below two methods to inject the dependencies:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Constructor Injection&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Setter Injection&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When we use Spring, the control is inverted which means we tell Spring the dependencies of an object and it’s the job of Spring to create the objects and inject those dependencies appropriately which is why this principle is called Inversion of Control(IoC).&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class A {
  private B b; //A is dependent on B

  //Spring will call this constructor to pass an object of B
  public A(B b) {
    this.b = b;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  How does Spring know what to do?
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/59-mYIniU4o"&gt;
&lt;/iframe&gt;
&lt;br&gt;
On its own, Spring has no idea about the project. We need to pass some information to the framework.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZJsDRvmj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/2000/1%2AghFn_jH-oog2s7fh6LEp_w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZJsDRvmj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/2000/1%2AghFn_jH-oog2s7fh6LEp_w.png" alt="" width="596" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We provide the configuration metadata i.e. details about classes being managed, their dependencies(classes they’re dependent upon). Spring then reads that config, initialized it’s IoC container, and prepares the system.&lt;/p&gt;
&lt;h2&gt;
  
  
  How do I start?
&lt;/h2&gt;

&lt;p&gt;You need to setup a Java project first with correct maven dependencies.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/VoV2jfW2wNs"&gt;
&lt;/iframe&gt;
&lt;br&gt;
Once we have the project setup, we can start with Spring code.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As we know that we need to provide configuration metadata to IoC container. To do that, we will use &lt;em&gt;@Configuration annotation&lt;/em&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is a class-level annotation. We create a class, annotate it with @Configuration, then pass this class to IoC container.&lt;/p&gt;

&lt;p&gt;At server startup, Spring will scan this class to read the metadata and to find more details about the classes that it needs to manage.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The classes that we want Spring to manage are called **beans. **You can say this is just another name for class. A spring bean means a Java class that spring knows about.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Watch this video where we use both the annotations.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/UOAe94RpLa4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  @Bean alternatives
&lt;/h2&gt;

&lt;p&gt;@Bean is not the only way to configure a Java class as a Spring bean. There are other ways to do that. Few annotations that can do the same thing are as follows:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;@Component, @Service, @Repository in conjunction with @ComponentScan&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;These are explained in detail with hands-on here:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/L2GfpD5WCM0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Bean Scopes
&lt;/h2&gt;

&lt;p&gt;While being managed by Spring i.e. IoC container, each bean has a certain scope which essentially defines the scope of the object.&lt;/p&gt;

&lt;p&gt;A bean can have different scopes such as:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Singleton&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prototype&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Request&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Session&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Application&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Singleton means that IoC container will create a single object of a bean so every time you ask Spring container for an object of say ClassA, it will the same object every time. This is similar to Gang of Four Singleton design pattern with a difference that this scope is guaranteed by the IoC container. You’re still free to create a new object using &lt;strong&gt;new&lt;/strong&gt; keyword.&lt;/p&gt;

&lt;p&gt;Just opposite is the Prototype scope, which means a new object every time.&lt;/p&gt;

&lt;p&gt;Here we discuss all this in great detail:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/4nMOGehJ-yk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Lazy and Eager initialization
&lt;/h2&gt;

&lt;p&gt;It explains when a bean will be initialized and a new object of the bean is created by Spring container.&lt;/p&gt;

&lt;p&gt;It will make more sense if you go through this video as you get to see the practical details:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/FBs0yCmOLhg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  @PostConstruct and @DependsOn
&lt;/h2&gt;

&lt;p&gt;In continuation of lazy and eager initialization, we should also understand the lifecycle of a bean and how beans can be dependent on each other. It is actually important that we identify and setup beans accordingly as out of order initialization can crash an application.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/HtW7yWa9PhE"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/XHz0ryPqqiY"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Autowiring
&lt;/h2&gt;

&lt;p&gt;Autowiring is the process by which Spring’s IoC container identifies the object dependencies and wire them together where needed.&lt;/p&gt;

&lt;p&gt;For instance — If we configured that ClassA needs an object of ClassB that means ClassB is a dependency of ClassA so IoC container will create objects of ClassA and ClassB, and inject the object of ClassB in ClassA automatically.&lt;/p&gt;

&lt;p&gt;@Autowired annotation simplifies the autowiring process which can be used on variable declaration, constructors, and setter methods.&lt;/p&gt;

&lt;p&gt;Autowiring is explained here in great details with examples:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/H1eKX26i714"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/YKrR57_NoM0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

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