Fading Coder

One Final Commit for the Last Sprint

Implementing Date-Filtered Article Archives and AOP-Driven Redis Caching

Implementing Date-Filtered Article Archives The archive endpoint accepts a POST request at /articles, expecting year and month parameters within the request body. The response adheres to a standardized envelope containing a success indicator, HTTP status code, descriptive message, and an array of ar...

Global Error Handling for Spring WebFlux Functional REST APIs

Centralized exception handling in reactive REST services avoids duplicating try/catch logic across handlers, produces consistent error payloads, and centralizes error code management. Single place to map exceptions to HTTP status codes and payloads Consistent JSON shape for all failures Cleaner hand...

Integrating RestTemplate with an OkHttp Connection Pool in Spring Boot

OkHttp provides an efficient HTTP stack for RestTemplate by reusing sockets across requests to the same host, pooling idle connections to cut latency, transparently compressing responses with GZIP, and retrying recoverable network failures. With TLS support (including SNI/ALPN) and IP failover on co...

Collecting Spring Boot Application Logs with Graylog

Spring Boot Log Aggregation with Graylog Graylog ovevriew Centralized log platform built around Elasticsearch for search/storage and MongoDB for configuration/state. Ingests logs via inputs such as GELF (UDP/TCP), Syslog, and more. Web UI and REST API exposed on port 9000 by default. Deployment with...

Spring Boot with MyBatis: Essential SQL Patterns Using Annotations

1. Project setup 1.1 Dependency Add MyBatis Spring Boot starter to pom.xml. <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.3.1</version> </dependency> 1.2 Data source configuratio...

Configuring MyBatis with Multiple Data Sources in Spring Boot

Confgiuring multiple databases in a single Spring Boot application with MyBatis requires defining separate DataSource, SqlSessionFactory, and SqlSessionTemplate beans per database, and mapping each mapper package to the appropriate factory/template. Maven dependencies <dependencies> <depend...

Implementing TCP Servers with Spring Boot Using BIO, NIO, and Netty

BIO (Blocking I/O) Blocking I/O dedicates a thread to each connection. Accept, read, and write operations block the calling thread until data is available or an operation completes. Under high concurrency this approach consumes many threads and context switches. BIO echo server BioEchoServer.java pa...

Streaming Server‑Sent Events with Spring Boot WebFlux and a JavaScript EventSource Client

Streaming updates from a Spring Boot WebFlux backend to a browser can be implemented with Server‑Sent Events (SSE). SSE uses a long‑lived HTTP connection where the server pushes events to the client, while the client remains read‑only. Compared with WebSocket, SSE is one‑directional (server → client...

Handling invalid request target characters in Tomcat 8.5+ under RFC 7230/3986

Symptom Upgrading to Tomcat 8.5+ (including the embedded Tomcat in Spring Boot) may reject requests whose path or query contains characters such as {, }, [, ], |, \ and others. A typical failure looks like: java.lang.IllegalArgumentException: Invalid character found in the request target. The valid...

Connecting Multiple RabbitMQ Brokers in Spring Boot

Spring Boot’s AMQP auto-configuration is great for a single RabbitMQ broker, but many systems need to talk to more than one. To support multiple brokers, define separate ConnectionFactory, RabbitTemplate, RabbitAdmin, and listener container factory beans for each broker and mark one as primary. Conf...