Best of Foojay.io2025

  1. 1
    Article
    Avatar of foojayioFoojay.io·1y

    Building a Real-Time AI Fraud Detection System with Spring Kafka and MongoDB

    This tutorial explains the step-by-step process of building a real-time fraud detection system using Spring Kafka, MongoDB, and AI-generated embeddings. It covers setting up a MongoDB database and creating a vector search index to detect anomalies in transaction data. The guide also illustrates creating synthetic customer profiles and generating transactions to analyze historical patterns for potential fraud, along with optimizing performance strategies.

  2. 2
    Article
    Avatar of foojayioFoojay.io·1y

    Event-Driven Architecture and Change Data Capture Made Easy

    Event-Driven Architecture (EDA) and Change Data Capture (CDC) are key techniques in modern software systems. EDA relies on components producing and consuming events to trigger actions, making systems flexible and scalable. CDC tracks database changes and converts them into events for other systems. EDA is used for decoupling services and real-time communication, while CDC synchronizes data and powers analytics. They can be used together for combining decoupled workflows with real-time data tracking. Understanding when to use each can help build efficient and maintainable systems.

  3. 3
    Article
    Avatar of foojayioFoojay.io·42w

    Monolith vs Microservices in 2025

    The software architecture landscape in 2025 shows a shift from microservices hype toward balanced, context-driven decisions. Developer experience and simplicity are driving many teams back to monoliths or modular monoliths, while Infrastructure as Code tools like Terraform make architecture changes more manageable. Enterprises are embracing the stability and traceability of monolithic approaches, prioritizing sustainability and clarity over theoretical scalability. The debate has evolved from choosing sides to making informed decisions based on team needs, organizational context, and long-term maintainability.

  4. 4
    Article
    Avatar of foojayioFoojay.io·1y

    Rate limiting with Redis: An essential guide

    Rate limiting is essential for managing traffic, preventing abuse, and ensuring fair access to resources. Redis is a preferred tool for implementing rate limiting due to its speed, reliability, and features. The choice of rate-limiting pattern, such as leaky bucket, token bucket, fixed window counter, sliding window log, or sliding window counter, depends on traffic patterns, precision needs, and resource constraints. Understanding these patterns and their trade-offs helps in building efficient, fair, and user-friendly systems.

  5. 5
    Article
    Avatar of foojayioFoojay.io·41w

    Preparing for Spring Boot 4 and Spring Framework 7: What’s New?

    Spring Boot 4 and Spring Framework 7 introduce significant enhancements including built-in resilience features with @Retryable and @ConcurrencyLimit annotations, a fluent JMS client API, robust API versioning, and modular architecture. Key improvements include support for Jackson 3.x, JSpecify for null safety, enhanced SSL health reporting, multiple TaskDecorator beans support, and better integration with modern ecosystems like Kotlin 2.2 and Jakarta EE 11. The modular codebase refactoring breaks up monolithic auto-configuration JARs into focused packages, while milestone artifacts are now available in Maven Central for easier dependency management.

  6. 6
    Article
    Avatar of foojayioFoojay.io·25w

    Building Systems That Know Why They Exist ~ When Data, Logic, and Intent Finally Align

    Requirements-as-Code (RaC) is an engineering discipline that treats requirements and business rules as executable data models rather than static documentation. By storing requirements as structured, versioned data in systems like MongoDB, software can maintain a living connection to its original intent throughout its lifecycle. This approach enables systems to interpret documented purpose at runtime, validate behavior against intent, and maintain semantic alignment between what software does and what it was meant to do. When combined with AI for natural language compilation, RaC creates systems that don't just execute code but understand why they exist.

  7. 7
    Article
    Avatar of foojayioFoojay.io·1y

    How JVM handles exceptions

    The JVM handles exceptions through a structured mechanism involving bytecode instructions and an exception table. When an exception is thrown, the JVM looks up the appropriate handler in the method's exception table. Handlers can be catch or finally blocks, and each handler specifies a range of instructions it covers and a target address where execution should continue. If no handler is found, the JVM looks up the call stack until it finds an appropriate handler, executing any finally blocks it encounters along the way.

  8. 8
    Article
    Avatar of foojayioFoojay.io·25w

    Java 25: What’s New?

    Java 25 is the new Long-Term Support release featuring 18 JEPs. Key additions include PEM format support for cryptographic objects, Stable Values API for lazy initialization, JFR enhancements with CPU-time profiling and method timing/tracing, and improved AOT capabilities with method profiling. Several preview features graduate to standard including Scoped Values, Module Import Declarations, and Compact Source Files. The release removes 32-bit x86 support and includes performance optimizations like improved String hashcode handling and new security algorithms.

  9. 9
    Article
    Avatar of foojayioFoojay.io·35w

    Design Patterns Update to JDK25

    JDK 25 introduces enhanced switch statements and pattern matching capabilities that modernize the implementation of classic design patterns. The release includes significant JEPs like Stream Gatherers, Unnamed Variables & Patterns, and Compact Source Files with Instance Main Methods. These features enable more functional programming approaches, improving code readability and maintainability while addressing complex implementation challenges across Creational, Structural, and Behavioral design patterns.

  10. 10
    Article
    Avatar of foojayioFoojay.io·27w

    Document Your Spring REST APIs with Annotations

    Learn how to document Spring REST APIs using Swagger/OpenAPI annotations like @Tag, @Operation, @Parameter, @ApiResponse, and @Schema. These annotations keep API documentation synchronized with code, making endpoints self-documenting and easier to maintain. The guide includes practical examples of annotating controllers and DTOs, explains why documentation matters for team onboarding and client integrations, and provides a step-by-step approach to gradually adding documentation to existing APIs.

  11. 11
    Article
    Avatar of foojayioFoojay.io·48w

    Benchmark and profiling Java with JMH

    JMH (Java Microbenchmark Harness) provides accurate performance measurement for Java applications by handling JVM optimizations that can skew results. The framework offers different benchmark modes (throughput, average time, single shot, sample time), state management with @State and @Setup annotations, and integration with async profiler for detailed performance analysis. Key considerations include preventing dead code elimination using Blackhole, avoiding constant folding with variable data, and using flame graphs to identify performance bottlenecks beyond just timing measurements.

  12. 12
    Article
    Avatar of foojayioFoojay.io·1y

    The Proper Way to Define Configuration Properties in Spring

    Learn the proper way to define configuration properties in Spring Boot 3 after migrating from Spring Boot 2. Understand the issues with using Lombok and classes, and how to address them by using records. Discover how to validate configuration properties at start-up time and document your configuration for better IDE support.

  13. 13
    Article
    Avatar of foojayioFoojay.io·45w

    Spring Boot documentation with Redocusaurus

    A step-by-step guide showing how to generate OpenAPI specifications from Spring Boot applications and create interactive API documentation using Redocusaurus, a Docusaurus plugin. Covers adding SpringDoc dependency, exporting API specs, setting up Redocusaurus with configuration, and deploying the resulting documentation site to various hosting platforms.

  14. 14
    Article
    Avatar of foojayioFoojay.io·30w

    Spring Framework 7 API Versioning Explained

    Spring Framework 7 introduces native API versioning support through a new version attribute in @RequestMapping annotations. The framework provides multiple versioning strategies including request header, path segment, query parameter, and media type parameter approaches. Developers can configure versioning either through annotation-based WebMvcConfigurer implementations or property-based configuration in application.properties. The feature includes built-in components for version resolution, parsing (supporting semantic versioning), validation, and deprecation handling to maintain backward compatibility while evolving APIs.

  15. 15
    Article
    Avatar of foojayioFoojay.io·51w

    Brokk: AI for Large (Java) Codebases

    Brokk is a standalone AI-powered application designed to help developers work with large Java codebases more effectively. Unlike IDE plugins, it focuses on context management through a Workspace system that allows precise control over what information the AI sees. Key features include intelligent file summarization, Git integration for historical context, dependency decompilation, and agentic tools for code search and analysis. The tool addresses the primary challenge of AI coding assistants: lack of sufficient codebase knowledge that leads to hallucinated APIs and suboptimal solutions.

  16. 16
    Article
    Avatar of foojayioFoojay.io·32w

    7 habits of Highly Effective Java Coding

    Seven practical habits for Java developers using AI coding assistants effectively. Covers taking ownership of AI-generated code, providing rich context for better outputs, prioritizing maintainability over cleverness, validating dependencies for security risks, writing meaningful tests beyond coverage metrics, and conducting human-focused code reviews. Emphasizes that AI accelerates development but requires developer vigilance to ensure quality, security, and long-term maintainability.

  17. 17
    Article
    Avatar of foojayioFoojay.io·24w

    OpenTelemetry Guide

    Spring Boot 4 introduces native OpenTelemetry support through a single starter dependency, simplifying observability implementation. The guide covers configuring metrics, traces, and logs using the OTLP protocol, including step-by-step setup with Micrometer integration, Logback appender configuration, and Docker Compose testing with Grafana. This eliminates the need for multiple dependencies and Java agents required in Spring Boot 3, while providing seamless integration with GraalVM and AOT compilation.

  18. 18
    Article
    Avatar of foojayioFoojay.io·48w

    Sentiment Analysis with Java, Quarkus, LangChain4j, and Local LLMs

    A hands-on guide to building a local sentiment analysis REST API using Java, Quarkus, and LangChain4j with Ollama-managed LLMs. The tutorial demonstrates creating a privacy-focused sentiment classifier that runs entirely on your machine using the Phi-3 Mini model, eliminating the need for cloud APIs or external dependencies. It covers project setup, AI service configuration, and testing with practical examples.

  19. 19
    Article
    Avatar of foojayioFoojay.io·1y

    From Reactive Streams to Virtual Threads

    Virtual Threads offer a fast and efficient threading solution for the JVM with a synchronous programming model. This post explores whether they can also provide the simplicity and resilience of Reactive Streams, questioning if they can challenge the status quo in data streaming.

  20. 20
    Article
    Avatar of foojayioFoojay.io·1y

    Token Bucket Rate Limiter (Redis & Java)

    The token bucket rate limiter is an efficient mechanism to manage request rates by using tokens added to a bucket at fixed intervals. Redis is used for tracking tokens, while Jedis provides a simple API for Redis commands from Java. The implementation includes adding dependencies, creating a TokenBucketRateLimiter class, validating requests, refilling tokens, and updating Redis. Thorough testing ensures correct behavior, including independent handling of clients, token refills, and capacity limits.