In this collection, we'll delve into topics ranging from modern concurrency with virtual threads to effective testing strategies with REST-assured. We'll also explore powerful libraries like Thymeleaf and Jakarta WebSocket for building robust web applications.
Dive into these valuable resources to enhance your Java development skills. Also, consider subscribing to the newsletter to get weekly feeds on Java and Spring Boot articles.
📖 Helpful Resources
🚀 Ready to Level Up Your Development Skills?
Checkout: Get Your Hands Dirty on Clean Architecture 🚀
🚀Preparing For Java Interview?
Checkout: Grokking the Java Interview. 🚀
🚀Preparing for Spring-Boot Microservice Interview?
Checkout: Guide To Clear Spring-Boot Microservice Interview 🚀
🚀250+ Spring Professional Certification Practice Questions🚀
Java Evolves to Tackle Virtual Threads Pinning with JEP 491
JEP 491, Synchronize Virtual Threads without Pinning, has been promoted to Proposed to Target status for JDK 24. This proposal aims to overhaul how Java's synchronized methods interact with virtual threads to eliminate the longstanding issue of “pinning” that limits thread scalability. Virtual threads, introduced in JDK 21, enable increased throughput of applications utilizing hundreds of thousands of threads.
Introduction to Lanterna
Lanterna is a Java library that allows to build text-based user interfaces. It provides functionalities for terminal manipulation, character and color control, keyboard input handling, and even full-fledged GUI creation with windows, panels, and interactive components. By using Lanterna, we can create terminal-based applications with rich user interfaces, making them more user-friendly and engaging.
The best way to determine the optimal connection pool size
This article discusses the importance of determining the optimal connection pool size for a database application. It explains how using the FlexyPool IncrementPoolOnTimeoutConnectionAcquisitionStrategy can help discover the optimal size. By conducting performance tests and monitoring the application's behavior under different load conditions, we can identify the right pool size to balance resource usage and application performance.
Templating with Thymeleaf: Custom Dialects and More
This article delves into the advanced features of Thymeleaf, focusing on custom dialects and expression utility objects. Custom dialects allows to extend Thymeleaf's functionality by creating processors and tags, making templates more concise and expressive. Expression utility objects simplify common tasks like string manipulation, date formatting, and working with collections. The article also discusses custom template resolving, which allows to load templates from various sources beyond the standard file system. By leveraging these advanced features, we can create powerful and flexible Thymeleaf templates that align with project's specific needs.
Asserting JSON Responses with REST-Assured in Java
This article explains how to use Java REST-assured to assert JSON responses in REST API testing. It covers setting up REST-assured, asserting JSON responses, and using JSONAssert for relaxed comparisons. It also discusses using JSON Assert Hamcrest and JSONUnit Hamcrest for flexible assertions that can ignore extra fields.
Jakarta WebSocket Essentials: A Guide to Full-Duplex Communication in Java
This article delves into the fundamentals of Jakarta WebSocket, a powerful Java API for establishing real-time, bidirectional communication between a client and a server over a single TCP connection. It also provides a comprehensive guide, covering the core concepts, practical implementation, and best practices for leveraging Jakarta WebSocket in the Java applications.
How to Read JSON Files in Java Using the Google Gson Library
This article explains how to read JSON files in Java using Google Gson. JSON is a lightweight, human-readable, and language-independent data format. Google Gson is a popular Java library for working with JSON data. It can convert Java objects to JSON and vice versa. The fromJson()
method of the Gson class is used to read JSON files in Java applications. It provides a helpful guide on utilizing Google Gson to parse JSON data within Java projects.
Spring Boot @ConditionalOnMissingClass Annotation Explained
The @ConditionalOnMissingClass
annotation in Spring Boot is a powerful tool for creating modular and adaptable applications. It allows to conditionally load beans or configurations based on the absence of specific classes on the classpath. This enables to define fallback configurations or alternative implementations when certain dependencies are not available. By carefully using this annotation, we can create more flexible and robust Spring Boot applications.
How to use virtual threads with ScheduledExecutorService
This article is about using virtual threads with ScheduledExecutorService in Java. It explains what virtual threads are and how to use them for scheduling tasks. It also covers using Thread.sleep() and ScheduledExecutorService to schedule virtual threads. Virtual threads are a lightweight alternative to the Thread class, improving concurrency in high-throughput applications. Their low cost eliminates the need for resource pooling techniques when scheduling tasks to a limited number of threads.