Introduction
📝
This week’s collection includes multithreading, gRPC, microservices, and Spring Data. These resources aim to help developers improve their skills, tackle common problems, and stay updated on the latest tools and techniques. Whether you're preparing for interviews or enhancing your real-world project skills, this collection provides valuable insights for Java developers.
Table of Contents
Top Picks ⭐
Modern Java Deep Dive
Spring AI DeepSeek Integration
Mastering gRPC with Java and Spring Boot: Build a Healthcare App
Latest 🔥
Building Resilient Apps with Retry Mechanisms
Spring Boot: JPA (Part-8)
Taking Out the Trash in Java
Open Source 🛠️
Piggy Metrics
Career Development 📚
Java Multithreading Crash Course
Spring Boot and Java Made Easy For Job & Interviews
Top Picks
⭐
1. Modern Java Deep Dive
The Devoxx session explores new Java features beyond version 21, focusing on Java 22 and 23. The speaker polls the audience on their latest production Java versions, highlighting trends.
The session covers finalized features like unnamed patterns, the Foreign Function & Memory API, and generational ZGC, along with preview features. A GitHub scraper example demonstrates pattern matching, sealed types, and switch expressions as alternatives to the visitor pattern.
The importance of exhaustive switches and handling default behavior is emphasized. The talk is interactive, with slides available and a scheduled break.
2. Spring AI DeepSeek Integration
This article introduces Spring AI, which simplifies AI application development within the Spring ecosystem, integrating popular providers like OpenAI, Azure AI, and Hugging Face.
It details how to use the DeepSeek API in a Spring application, including setting up dependencies and configuring the API key. The example code shows how to create a
ChatController
for generating AI responses with the DeepSeek chat model.The API supports generating responses and streaming them, but embedding functionality is disabled as DeepSeek does not support embeddings.
3. Mastering gRPC with Java and Spring Boot: Build a Healthcare App
The video covers gRPC basics and demonstrates building a gRPC-based microservice using Java and Spring.
It explains RPC evolution from RMI, CORBA, and SOAP to REST, highlighting REST’s inefficiencies with JSON and HTTP 1.1. gRPC addresses these with Protobuf and HTTP/2, offering high performance, multiplexing, and streaming.
It discusses gRPC’s advantages, drawbacks, and streaming types. Finally, it explores Java development options, including the official gRPC Java library, a third-party Spring Boot starter, and Spring’s experimental gRPC project, before building a service using Spring’s support.
Latest 🔥
1. Building Resilient Apps with Retry Mechanisms
This article emphasizes the role of retry mechanisms in creating resilient applications by handling transient failures in external systems. It covers retry policies, idempotency, and circuit breakers, with examples in Java, JavaScript, and Python.
Best practices include exponential backoff, retry limits, logging, and combining retries with circuit breakers to ensure resilience, prevent overload, and maintain data consistency.
2. Spring boot: JPA (Part-8) | JPQL, Derived Query, N+1 Problem, Joins, Pagination, and Sortin,g etc.
The video explains derived queries in Spring Data JPA, which automatically generate queries based on method names. These methods must follow specific naming conventions, starting with keywords like
find
,get
, ordelete
, followed by entity field names.Derived queries support filtering (
by
+ field name), logical operators (And
,Or
), and comparisons (IsIn
,Between
). They also allow pagination (Pageable
) and sorting (Sort
). However, derived queries are best suited for simple queries, as they don't support complex operations like joins. For more advanced needs, JPQL or native queries should be used.
3. Taking Out the Trash in Java
Memory management in Java is handled by the JVM through garbage collection (GC), which automates memory reclamation and prevents memory leaks. The JVM divides memory into regions like heap (for objects) and stack (for method calls and local variables).
Garbage collection identifies and frees unreachable objects, improving memory utilization and simplifying development. Various garbage collectors (GCs), such as Serial, Parallel, G1, ZGC, Shenandoah, and Epsilon, offer different trade-offs in terms of performance and suitability for various workloads.
Best practices include minimizing object creation, reusing objects, and optimizing memory usage through profiling and heap tuning.
4. Mocking in Unit Tests: Mockito vs. EasyMock vs. JMockit
The article compares three popular Java mocking frameworks: Mockito, EasyMock, and JMockit. It discusses their ease of use, flexibility, performance, and community support.
Mockito is praised for its simplicity and broad support, EasyMock offers a bit more complexity but is still useful, while JMockit provides advanced capabilities at the cost of a steeper learning curve.
Each framework has its strengths depending on the use case, with Mockito being the most accessible and widely used.
5. A Simple HTTP Server With Java ServerSocket
The article on Baeldung walks through building a simple HTTP server in Java using
ServerSocket
. It demonstrates how to listen for client requests, process them, and send HTTP responses.Key concepts such as handling input and output streams, creating a basic response, and using HTTP status codes are covered. This simple server serves as an introduction to socket programming and HTTP communication in Java.
6. The Mechanics of Request Mapping in Spring Boot
Spring Boot simplifies HTTP request handling through annotations like
@RequestMapping
and its specialized versions (e.g.,@GetMapping
,@PostMapping
).These annotations map HTTP requests to controller methods, with
RequestMappingHandlerMapping
responsible for detecting and registering mappings during startup. Path matching is handled using Ant-style patterns, and since Spring 5.3,PathPatternParser
offers improved performance.HTTP method resolution ensures requests are routed to the correct method based on both path and method. Spring Boot uses
RequestMappingHandlerAdapter
for invoking handler methods, resolving parameters, and converting return values.Exception handling, parameter binding, and type conversion are integral, with Spring offering robust tools for validation and custom error handling.
7. Sliding Window Log Rate Limiter (Redis & Java)
This article explains how to implement a sliding window log rate limiter using Redis and Java. Unlike fixed-window limits, this method tracks requests by logging timestamps and enforces limits based on a rolling time window.
The process involves logging each request, removing expired entries, and counting requests within the time window to check if the limit is exceeded.
The example uses Jedis, a Java Redis library, to handle interactions with Redis, allowing for efficient rate-limiting logic. The full implementation and testing are also covered.
8. Passwordless Authentication Unlocked: One-Time Tokens in Spring Security 6.4
This article explains how to implement One-Time Token (OTT) login in Spring Security 6.4. It guides setting up a basic web app that uses a Magic Link for passwordless login.
After requesting the token, the user receives a link by email and clicks it to log in. The app integrates with Spring Security's
oneTimeTokenLogin()
feature and uses SendGrid for email delivery.The code and configuration details are shared for setting up the application, including security and email service components.
9. Spring Data Neo4j: How to update an entity
This article discusses several methods for updating entities in Spring Data Neo4j. It explains the limitations of the default
save()
method, which overwrites unspecified fields withnull
.For more controlled updates, it suggests using a
PATCH
method to update specific fields or using custom Cypher queries for flexibility.It also highlights that using a
PATCH
request avoids overwriting other fields, while Cypher allows targeted property updates, although it requires custom modifications for different fields.
Open Source
🛠️
1. Piggy Metrics
PiggyMetrics is a microservice-based financial advisor app using Spring Boot, Spring Cloud, and Docker. It features services for account management, statistics calculation, and notifications, each with its own database (MongoDB). The app demonstrates how to implement core microservice patterns like API communication and centralized configuration via Spring Cloud Config. The project is designed as a tutorial and can be expanded for other uses. The services are deployable independently, supporting features like user authentication and time series tracking
Career Devlopment
📚
1. Java Multithreading Crash Course – Quick Revision for Interviews
This guide covers essential Java multithreading concepts, including thread creation using
Thread
andRunnable
, memory management, and synchronization challenges like deadlocks and race conditions.It explores solutions such as synchronized blocks, Locks, and Atomic classes. The Java ExecutorService framework is highlighted for efficient thread management, along with Java 21’s virtual threads for lightweight concurrency.
It also includes key interview questions on thread lifecycle, daemon threads, and the Fork/Join framework, making it a valuable resource for mastering multithreading in Java.
2. Spring Boot and Java Made Easy For Job & Interviews
This LinkedIn post shares guide on Spring Boot covers essential topics for Java developers, including an introduction to Spring Boot and its benefits. It addresses key areas such as configuration, creating REST APIs, data access with JPA, and security features like JWT and OAuth2.
The guide also explores messaging (RabbitMQ, Kafka), cloud and microservices (Eureka, Config Server), and DevOps practices (Docker, monitoring, deployment), providing a comprehensive overview for interviews and real-world projects.