Java Weekly, Issue 595
1. Spring and Java >> Hibernate 7 (and Hibernate Validator 9) [in.relation.to] A big release! Hibernate ORM 7 is officially out with version 7.0.0.Final. This includes a complete implementation...
View ArticleLoading Test Data from Files in JUnit Tests with Java Test Gadgets Test Data...
1. Overview When writing JUnit tests, we may need to make test data to use as inputs or expected outputs of our code. We can do this by instantiating Java objects within our tests, or in test data...
View Article@Expose vs @SerializedName Annotations in Gson
1. Introduction Gson is an open-source Java library developed by Google to facilitate the conversion of objects to JSON and vice versa. It provides efficient serialization and deserialization...
View ArticleArguments Prefixes in the JVM
1. Overview The Java Virtual Machine (JVM) is a powerful engine that powers Java applications. It executes compiled .class files, manages memory, and boosts performance using the techniques like...
View ArticleSanitize HTML Code to Prevent XSS Attacks
1. Introduction Cross-Site Scripting (XSS) is a type of vulnerability that allows attackers to inject malicious scripts into web applications. Attackers can execute these scripts in the user’s browser,...
View ArticleAdd a Line Break/Blank Line After Log Statements in Java
1. Overview If we’ve ever stared at a wall of log output trying to figure out what went wrong, we’re not alone. Logs are supposed to make our lives easier, but they can quickly become overwhelming,...
View ArticleCollision Detection Between Two Images in Java
1. Overview Collision detection is a vital component of game development, computer graphics, and simulation software. In Java, developers can detect image (or sprite) collisions using various methods,...
View ArticleFixing the Hibernate Error “DuplicateMappingException: Column is Duplicated...
1. Overview In this short tutorial, we’ll highlight how to fix the Hibernate error “DuplicateMappingException: Column is duplicated in mapping for entity“. First, we’ll look at the main cause of the...
View ArticleGenerate a Unique Integer From a Unique String
1. Overview In this quick article, we’ll explore the possibilities to generate a unique Integer from a unique String. While Java offers several ways to achieve this, each approach balances speed,...
View ArticleA Guide to OpenAI Text-to-Speech (TTS) in Spring AI
1. Introduction Nowadays, applications benefit greatly from neural network integration, such as knowledge bases, assistants, or analytics engines. One practical use case is converting text into speech....
View ArticleConverting a String to a SOAPMessage
1. Introduction In this tutorial, we’ll explore how to convert a raw SOAP XML string into a usable SOAPMessage object in Java. A SOAPMessage is part of the Java API for XML-based messaging (SAAJ) and...
View Article@Provides vs Provider Classes in Guice
1. Introduction In this tutorial, we’ll discuss Guice, Google’s Dependency Injection framework, and how the @Provides annotation differs from Provider classes in Guice. 2. Guice Basics Google created a...
View ArticleJava Weekly, Issue 596
1. Spring and Java >> How to send prompts in bulk with Spring AI and Java Virtual Threads [foojay.io] A guide to combining Spring AI with Java virtual threads to process hundreds of prompts to...
View ArticleReplace Specific Word From File With Java
1. Introduction In this tutorial, we’ll see how we can replace a specific word in a file using various standard Java packages and the Apache Commons IO library. 2. Sample Data We’ll use the sample data...
View ArticleIntroduction to Tribuo – A Java Machine Learning Library
1. Overview Machine Learning (ML) and Artificial Intelligence (AI) are reshaping software development by enabling systems to learn from data and make intelligent predictions. Tribuo is a...
View ArticleHow to Return anydata on GraphQL Mutation
1. Introduction When working with GraphQL mutations, we often encounter situations where returning a fixed type is too limiting. For example, sometimes we may want to return a simple success message,...
View ArticleA Guide to Embeddings Model API in Spring AI
1. Overview Integrating artificial intelligence into an application typically involves working with text data. A critical technique in this domain is the embedding model, which converts textual...
View ArticleHow to Do Nested Mapping in Mapstruct?
1. Overview In this tutorial, we’ll utilize the MapStruct library to map nested properties from a source POJO to the properties of a target POJO. Similarly, we may use the same technique discussed in...
View ArticleJava Weekly, Issue 597
1. Spring and Java >> Java 25 Introduces Stable Values API for Deferred Immutability and Improved Application Startup [infoq.com] JDK 25 introduces the StableValue API (as a preview feature),...
View ArticleResolving Spring JDBC “IncorrectResultSetColumnCountException: Incorrect...
1. Overview When working with Spring’s JdbcTemplate, we often need to convert the query result to a List of POJOs. However, a common pitfall we might encounter is the...
View Article