In this Engineering With Java newsletter edition, we have hand-picked some interesting Java and Spring articles worth reading. Topics include inheritance with JPA and Hibernate, Bridge design patterns, Spring Security with Firebase, Stored procedure with JDBC, Embedded Java, fluent DSL, etc.
Embeddable Inheritance with JPA and Hibernate
This article discusses how to use embeddable inheritance in JPA and Hibernate, a feature introduced in Hibernate 6.6. It covers mapping an inheritance hierarchy in embeddable types, such as email and SMS subscriptions within a
Subscriber
entity.By using annotations like
@Embeddable
and@DiscriminatorColumn
, it efficiently handles polymorphism, allowing developers to design more flexible models.The tutorial also includes SQL generation examples, showing how this approach reduces the need for complex entity mappings
Understanding the Bridge Design Pattern in Java: A Simplified Guide
This article from Java Code Geeks explains the Bridge Design Pattern in Java, which decouples an abstraction from its implementation so that both can evolve independently.
It provides an example using devices (like TV and Radio) and remote controls, where the device acts as the implementation and the remote control as the abstraction.
This pattern enhances flexibility and scalability, allowing you to change the abstraction or implementation without affecting the other.
Spring Boot and SOLID: A Perfect Match
This article explores how Spring Boot aligns with the SOLID principles, providing a robust framework for building maintainable, scalable applications.
It highlights how each SOLID principle (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) can be applied in a Spring Boot project to enhance code quality, modularity, and testability.
The article also discusses practical examples of implementing these principles within Spring Boot applications.
🚀 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.
Integrating Firebase Authentication With Spring Security
This article on Baeldung explains how to integrate Firebase Authentication with Spring Security in a Spring Boot application. It details the steps to set up Firebase, configure authentication tokens, and secure APIs using Firebase's authentication capabilities.
The guide walks through adding dependencies, writing a security configuration, and handling authentication tokens in a Spring Security context.
Stored Procedures With Spring JdbcTemplate
This article on Spring's
JdbcTemplate
with stored procedures demonstrates how to call and manage stored procedures in a Spring application. It covers configuringJdbcTemplate
, executing procedures usingSimpleJdbcCall
, handling input and output parameters, and managing results.The tutorial also explains the benefits of using stored procedures for database-intensive operations and provides examples of calling a stored procedure from Java code in Spring Boot.
A Fresh Look at Embedded Java
This article takes a fresh look at Java's role in embedded systems. Java, once focused on embedded devices, continues to play a crucial role in areas like automotive infotainment, home automation, medical devices, and more. The piece highlights Java's energy efficiency and adaptability, even in small, ARM-based platforms like Raspberry Pi.
It also details how Azul's OpenJDK builds cater to embedded needs with solutions like faster startup times through CRaM and CRaC, offering custom builds and long-term support for various platforms.
Guide to Micronaut Environments
This article is about Micronaut environments. It discusses what they are and how they are similar to Spring profiles. It also details how to set up Micronaut environments.
Some important points are that Micronaut environments are abstractions related to profiles and can be used to create different sets of properties. They can be set using the micronaut.environments argument, the defaultEnvironment() method, or the MICRONAUT_ENV environmental variable.
Understanding Floating-Point Precision Issues in Java
This article explores floating-point numbers in Java. It details the two types —
float
anddouble
— and how they are stored.The article also explains why floating-point calculations might produce unexpected results due to their binary representation, which can lead to precision loss.
How Stalactite ORM Implements Its Fluent DSL
This is an article about how the Stalactite ORM library implements a fluent DSL. It discusses what a fluent DSL is and the goals of the Stalactite project. The article details the use of Java proxies to implement the DSL.
Some challenges are noted, like needing to create composite interfaces. The article concludes by saying that a fluent DSL can improve the developer experience.