Introduction 📝
This collection features insightful articles and tutorials focused on modern Java and Spring Boot development practices.
Topics range from advanced testing techniques with WireMock, API rate limiting strategies using Redis, and real-time WebSocket notifications without external brokers, to securing microservices with OAuth2 and integrating GraphQL pagination.
We’ll also dive into Java best practices, gRPC-to-REST gateways, and cutting-edge improvements in Java machine learning libraries.
To get fresh and interesting Java and Spring Boot articles in your feed, subscribe to the java newsletter:
Testing Java Applications With WireMock and Spring Boot
This blog demonstrates how to effectively use WireMock to mock external HTTP services, specifically in a Spring Boot app communicating with LMStudio via LangChain4j.
Rather than relying on full test containers or mocking only our own interfaces, WireMock enables tests to simulate actual HTTP-based integrations, including streaming responses.
The guide walks through setting up a Spring Boot test with annotations like
@SpringBootTest
,@EnableWireMock
, and overriding the LMStudio base URL to point at WireMock’s simulated server.Ultimately, WireMock proves to be a powerful tool for confidently testing external API integrations—whether with Spring Boot or standalone Java applications.
https://dzone.com/articles/testing-java-applications-wiremock-spring-boot
API Rate Limits with Spring Boot and Redis Buckets
This article explains how to implement API rate limiting in Spring Boot using Redis and the token bucket algorithm. It uses
StringRedisTemplate
to manage tokens per user or IP, refilling over time and blocking requests when limits are exceeded.The logic is applied via a servlet interceptor, supporting both authenticated (JWT) and unauthenticated (IP-based) users. Redis ensures atomic, scalable enforcement, and the author shares best practices for key expiration and fallback handling.
Tracking Failed Attempts with Temporary Block Logic in Spring Boot
This article outlines how to monitor and limit failed login attempts (or similar actions) using Spring Boot, by tracking counts tied to identifiers like email, session ID, or IP address.
Stored in-memory or in Redis, these counters increment on each failure; once a threshold is met, further attempts are blocked temporarily—effectively slowing down brute‑force or misuse without affecting normal users.
It discusses the pros and cons of different tracking strategies (email-focused vs IP vs session) and offers guidance on selecting identifiers and block durations. Integration is shown via a servlet filter or interceptor that checks attempts and enforces blocks before authentication logic runs.
🚀 Java + Spring Boot + SQL Interview + Certification Prep 🚀
🎯 Perfect for aspiring developers, job switchers & interview prep warriors!🔥 What’s Inside (PDF format):
Grokking the Java Interview (Vol 1 & 2)
Grokking the Spring Boot Interview
Grokking the SQL Interview
Java SE 17 Developer Certification (1Z0-829) Guide
250+ Spring Framework Certification Practice Questions
WebSocket Notifications in Spring Boot Without External Brokers
This article demonstrates how to implement real-time WebSocket notifications in Spring Boot applications without relying on external message brokers like RabbitMQ or Kafka.
It leverages Spring’s built-in WebSocket support and
SimpMessagingTemplate
to send messages directly from the server to connected clients.The approach involves configuring a simple STOMP endpoint, handling client subscriptions, and broadcasting notifications using Spring’s messaging template. This setup simplifies deployment by removing the need for external infrastructure while still enabling scalable, event-driven communication between server and clients.
It’s ideal for apps needing lightweight, real-time updates without complex messaging systems.
Top 10 Java Gotchas That Still Catch Developers in 2025
Author outlines common Java pitfalls that continue to trip up developers despite being long-known issues. Key examples include mistakenly using
==
to compare objects instead of.equals()
, which causes reference rather than value comparison; failing to overridehashCode()
when overridingequals()
, which breaks the behavior of hash-based collections; and inadvertent autoboxing in performance-critical code leading to unexpected overhead.The article also covers issues related to Java concurrency, such as improper synchronization and visibility problems, as well as challenges around null handling, unchecked warnings, and mutable fields in records.
These gotchas often lead to subtle bugs and maintenance headaches. Ozcay emphasizes that awareness and understanding of these fundamentals are essential for writing reliable, clean Java code, even for experienced developers working with modern Java versions.
The article serves as a refresher and cautionary guide to avoid these classic mistakes.
Securing Spring AI MCP Servers With OAuth2
The article explains how to secure Spring AI MCP servers using OAuth2. It shows how to configure the server as both an authorization and resource server, enforcing JWT-based access to MCP endpoints.
Clients use
client_credentials
orauthorization_code
flows to obtain tokens and include them in requests. The setup ensures secure, token-protected communication between services and users, aligning with the MCP spec.
Pagination Support in Spring Boot GraphQL
This article explains how to implement pagination in Spring Boot GraphQL applications using Spring Data’s pagination support. It covers page-based pagination by accepting
page
andsize
parameters, creating aPageRequest
, and returning a paginated response with content and metadata like total pages and current page.It also covers cursor-based pagination (Relay-style), which uses a cursor to fetch the next batch of results, packaging data into edges and page info objects.
This approach helps handle large datasets efficiently and improves client-side navigation. Overall, it demonstrates how to seamlessly integrate pagination features into GraphQL APIs with Spring Boot.
Implementing gRPC to REST Gateway in Java
The article explains how to implement a gRPC-to-REST gateway in Java, enabling high-performance gRPC services to be accessed via familiar REST APIs. It covers two main approaches: using grpc-gateway, which generates a reverse proxy translating REST calls to gRPC based on Protobuf annotations, and using Envoy proxy with its gRPC-JSON transcoder filter to expose REST endpoints.
The guide emphasizes keeping Protobuf definitions as the single source of truth and securing the gateway properly. This setup allows internal services to leverage gRPC’s efficiency while providing external clients with easy-to-use REST interfaces.
How I Improved Zero-Shot Classification in Deep Java Library (DJL) OSS
Author explains how he improved zero-shot classification support in the open-source Deep Java Library (DJL), especially for models like DeBERTa. Initially, DJL didn’t handle
token_type_ids
correctly, which are essential for distinguishing sentence pairs in classification tasks.Additionally, the library misinterpreted label token positions and used a simplified softmax function that reduced accuracy. Raphael fixed these issues by enhancing DJL’s translator logic to read model configuration files properly and adjust token handling.
These changes brought DJL’s classification results in line with the Python Transformers library, improving both accuracy and reliability for Java developers using zero-shot models.
The improvements have been merged and will be included in DJL 0.34.0. This update is significant for Java ML practitioners needing state-of-the-art NLP capabilities without switching languages.