In this Engineering With Java newsletter edition, we have hand-picked 10 interesting Java and Spring articles worth reading. Topics include files for thumbnail conversion, Java 23 security enhancement, bean validation, pagination with spring data, etc.
🚀 Ace Your Next System Design Interview 🚀
Taught by a best-selling author, everything you need to take your system design skills to the next level.
How To Convert Files to Thumbnail Images in Java
This article discusses the process and benefits of converting files into thumbnail images in Java. It emphasizes automating thumbnail generation to enhance file processing workflows, particularly for large documents like PDFs and PowerPoint presentations.
Various open-source libraries, such as Apache PDFBox and Apache POI, are recommended for handling specific file types.
It also presents a solution using a web API to streamline thumbnail creation into a single operation, significantly reducing code complexity.
JDK 23 Security Enhancements
This article outlines the security enhancements in JDK 23, released on September 17, 2024. Key updates include improved performance for cryptographic operations, a new
KeyStore
for MacOS root certificates, and several new root CA certificates.It also highlights changes in authorization and Kerberos properties, such as case-sensitive principal name handling. Additionally, debugging capabilities have been expanded with new options for thread and timestamp logging.
The blog categorizes these enhancements into crypto, PKI, authorization, and miscellaneous updates.
Java Bean Validation: Applying Constraints Programmatically
This article explains how to implement Java Bean Validation constraints for third-party classes using custom annotations, like
UserId
.It covers configuring the Hibernate Validator in a Spring application, defining validation rules, and creating a validation component.
It includes testing scenarios to ensure the constraints are enforced effectively. This approach allows developers to apply validation without modifying the original entity classes.
🚀 Grokking the Java Interview 🚀
Crack your Java interview by preparing important topics and mastering key concepts in a guided and structured way in a short time.
Create Avro Schema With a List of Objects
This article explains how to create an Avro schema representing a parent-child relationship, where a
Parent
class contains a list ofChild
objects. It details the JSON structure of the Avro schema, including using record and array types, and provides a Maven configuration for generating Java classes from the schema.This article also includes example code for creating and serializing/deserializing these objects, demonstrating how to work with the generated classes.
Building a RAG App Using MongoDB and Spring AI
This article demonstrates how to build a Retrieval-Augmented Generation (RAG) application using Spring AI and MongoDB for storing and retrieving documents.
It explains the integration of a vector database for semantic search and describes the architecture, including the embedding model and similarity search capabilities.
The application allows users to save documents, perform similarity searches, and query using natural language to get context-aware answers from an LLM.
The code examples illustrate each step, from setting up dependencies to implementing the controller endpoints
Keyset Pagination with Spring Data WindowIterator
This article discusses using a custom
WindowIterator
in Spring Data to efficiently process large datasets. This iterator allows for chunked data retrieval, reducing memory usage while providing a convenient way to manage windowed operations on streams of data.It highlights the benefits of combining Spring Data with custom iteration logic, showcasing performance improvements and practical implementation examples.
Processing JDBC ResultSet With Stream API
This article explores processing JDBC
ResultSet
using Java's Stream API. It covers three main approaches: using Spliterators, jOOQ, and the jdbc-stream library, detailing how to create a stream of records while ensuring resource management to prevent leaks.Each method is illustrated with code examples, demonstrating how to retrieve city records from a database.
The article emphasizes the benefits of using streams for large datasets and functional programming styles.
How to replace multiple if else condition with map in Java?
This article explains how to replace multiple
if-else
statements in Java with aMap
for cleaner and more maintainable code. It illustrates this approach through examples, demonstrating how to use aMap
to associate keys with their corresponding actions or results.This method enhances readability and performance by avoiding complex conditional logic. The article concludes with best practices for implementing this technique effectively.
Azul Brings Java from Edge to Cloud
Azul provides Java runtimes for various platforms, from edge devices to cloud services. Their Zulu builds support embedded systems, client applications, and older Java versions.
Azul's Platform Prime (Zing) is optimized for cloud environments, offering enhanced performance, lower cloud costs, and quicker deployments for data-heavy workloads.
Zing features technologies like a better garbage collector and faster startup capabilities, aiming to improve efficiency and reduce resource costs for cloud applications.
Optimizing Spring WebFlux Logging with Zalando Logbook and ELK
This article discusses optimizing logging in Spring WebFlux applications using Zalando Logbook and the ELK stack (Elasticsearch, Logstash, and Kibana).
Zalando Logbook provides HTTP request and response logging, while ELK enables centralized logging and analysis. The combination enhances observability, debugging, and monitoring in reactive environments, ensuring effective traceability for incoming requests and responses.
The guide provides practical implementation steps to integrate these tools for better visibility and efficiency in Spring WebFlux applications.
What is Pagination in Java?
This article "What is Pagination in Java?" explains pagination, a technique for dividing data into smaller, manageable parts. It covers how to implement pagination in Java applications, especially when dealing with large datasets.
The author discusses different approaches, such as using
List.subList()
for in-memory pagination and using pagination queries for databases with Java frameworks like Spring Data JPA.Pagination helps improve application performance and user experience by reducing the data processed at a time.