In this Engineering With Java newsletter edition, we have hand-picked some interesting Java and Spring articles worth reading. Topics include a gateway with Spring Cloud, Lombok, Spring microservices, Junit CustomListeners, etc.
🚀 Unlock Your Path to Success with the Ultimate Everything Bundle! 🚀
Introducing the Everything Bundle — your one-stop solution to mastering Java, Spring Boot, SQL, acing interviews, and securing certifications!
1. How To Implement a Gateway With Spring Cloud
This article explains how to implement a gateway using Spring Cloud Gateway, which simplifies the interactions between external clients and microservices.
Key components include routes, predicates, and filters. It details configuring the gateway in a Spring Boot application using dependencies and
application.yaml
for defining routes.The article also covers creating custom predicates and filters and provides a practical example involving a
book
andauthor
service. The example demonstrates dynamic routing and request modification through filters.
2. The Hidden Costs of Lombok in Enterprise Java Solutions
The article discusses the hidden costs of using Lombok in enterprise Java solutions. While Lombok reduces boilerplate code and speeds up development, it introduces risks such as reduced code clarity, maintainability issues, and potential debugging complications.
It can lead to unexpected mutability and tightly coupled implementations. The author advises balancing short-term productivity gains with long-term project health by adhering to Java best practices and principles for creating robust, maintainable, and secure software.
3. Spring Microservice Tip: Abstracting the Database Hostname With Environment Variable
The article discusses how to abstract the database hostname in Spring microservices using environment variables. It explains configuring the database connection string in the
application.properties
file, where sensitive information such as the hostname is replaced with environment variables.This approach enhances security and maintainability by keeping configuration separate from the code. The article also provides a practical example of setting up the configuration and troubleshooting using the
ApplicationReadyLogger
class.
🚀 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.Â
4. JUnit 5 Custom TestListeners
This article explains how to use JUnit 5 listeners to post test execution results from CI/CD pipelines directly to a test management system via the Zephyr API.
It covers creating custom listeners to format and send test data, including test case names and execution results.
The example demonstrates configuring the listener, writing results to a JSON file, zipping the file, and making a POST request to upload the results.
5. Enhancing the Visibility of Integration Tests
This article discusses strategies for improving the visibility of integration tests in software projects. It emphasizes the importance of clear reporting, consistent test environments, and proper test categorization.
Tools and techniques such as logging, dashboards, and automated notifications are recommended to ensure that test results are easily accessible and actionable for the development team.
The goal is to enhance test transparency and facilitate quicker identification and resolution of issues.
6. Add Jar Files to Java Project Using Visual Studio Code
This article explains how to add JAR files to a Java project using Visual Studio Code. It covers setting up the environment, creating a project, and adding JAR dependencies.
The steps include configuring the
settings.json
file, updating thelaunch.json
for debugging, and managing JAR files through the project's.classpath
file.The guide provides detailed instructions and examples to ensure smooth integration of external libraries into Java projects in VS Code.
7. JFR Event to Detect Invocations of Deprecated Methods
This article announces the deprecation of several long-standing Java features. It explains the reasoning behind these decisions, focusing on promoting cleaner and more modern code practices.
The deprecated features include certain APIs and components that are outdated or have better alternatives.
The article also outlines the timeline for deprecation and removal, and advises developers on how to adapt their code to the changes.
8. JDK 23 G1/Parallel/Serial GC changes
This article discusses significant changes to garbage collection (GC) in JDK 23. It highlights improvements in performance and efficiency, focusing on enhancements to the G1 and ZGC collectors.
These changes aim to reduce pause times and optimize memory management. The article also details new features and adjustments that make GC more adaptable and robust for various applications.
9. Effective Java Logging
This article provides best practices for effective Java logging. It covers the importance of logging for debugging and monitoring and recommends using standard logging frameworks like SLF4J.
Key practices include setting appropriate log levels, using meaningful messages, avoiding excessive logging, and protecting sensitive information.
The article also suggests configuring log output destinations and formats for better readability and analysis.
10. Java Development: An Ideal Choice for Enterprise Solutions
This article on Java Revisited discusses why Java is an ideal choice for enterprise solutions. It highlights Java's stability, scalability, and robust security features.
The language's extensive ecosystem, mature frameworks, and strong community support make it well-suited for developing and maintaining large-scale applications.
Java's cross-platform capabilities and backward compatibility also contribute to its popularity in the enterprise environment.
🚀 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.