HowToDoInJava https://howtodoinjava.com/ Java, Spring and Hibernate Tutorials Sat, 10 Jan 2026 17:12:08 +0000 en-US hourly 1 https://wordpress.org/?v=6.9 https://howtodoinjava.com/wp-content/uploads/2022/07/cropped-howtodoinjava-logo-small-e1657903941532-32x32.png HowToDoInJava https://howtodoinjava.com/ 32 32 JUnit @AutoClose Annotation with Examples https://howtodoinjava.com/junit/junit-autoclose-examples/ https://howtodoinjava.com/junit/junit-autoclose-examples/#respond <![CDATA[Lokesh Gupta]]> Tue, 02 Dec 2025 11:23:01 +0000 <![CDATA[Junit]]> <![CDATA[JUnit 6]]> <![CDATA[JUnit Annotations]]> https://howtodoinjava.com/?p=42653 <![CDATA[

JUnit @AutoClose automatically close resources that implement AutoCloseable after each test, without requiring explicit cleanup code. If any exception occurs during closing the resource, the exception is suppressed.

The post JUnit @AutoClose Annotation with Examples appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/junit/junit-autoclose-examples/feed/ 0
Setting Up JUnit with Spring Boot Test https://howtodoinjava.com/junit/junit-version-with-spring-boot/ https://howtodoinjava.com/junit/junit-version-with-spring-boot/#respond <![CDATA[Lokesh Gupta]]> Tue, 02 Dec 2025 10:49:42 +0000 <![CDATA[Junit]]> <![CDATA[JUnit 6]]> <![CDATA[Spring Boot]]> https://howtodoinjava.com/?p=42650 <![CDATA[

Whether you are building REST APIs, service-layer logic, or data-access layers, Spring Boot offers first-class support for JUnit and provides convenient annotations and utilities for writing clean, maintainable tests.

The post Setting Up JUnit with Spring Boot Test appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/junit/junit-version-with-spring-boot/feed/ 0
JUnit 6 Nullability: @Nullable, @NotNull & @NullMarked https://howtodoinjava.com/junit/junit-6-nullability/ https://howtodoinjava.com/junit/junit-6-nullability/#respond <![CDATA[Lokesh Gupta]]> Mon, 01 Dec 2025 09:36:30 +0000 <![CDATA[Junit]]> <![CDATA[JUnit 6]]> https://howtodoinjava.com/?p=42647 <![CDATA[

With the release of JUnit 6.0.0, the maintainers adopted JSpecify nullability annotations across all JUnit modules. It means that method parameters, return types, and other API elements in JUnit are now annotated to explicitly declare whether they accept or return null.

The post JUnit 6 Nullability: @Nullable, @NotNull & @NullMarked appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/junit/junit-6-nullability/feed/ 0
JUnit 6 Gradle Dependency https://howtodoinjava.com/junit/junit-6-gradle-dependency/ https://howtodoinjava.com/junit/junit-6-gradle-dependency/#respond <![CDATA[Lokesh Gupta]]> Mon, 01 Dec 2025 08:50:04 +0000 <![CDATA[Junit]]> <![CDATA[JUnit 6]]> https://howtodoinjava.com/?p=42640 <![CDATA[

Learn how to configure JUnit 6 with Gradle. This tutorial discusses the artifacts we need, how to set up our build.gradle, and how to execute the tests.

The post JUnit 6 Gradle Dependency appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/junit/junit-6-gradle-dependency/feed/ 0
JUnit 6 Maven Dependency https://howtodoinjava.com/junit/junit-6-maven-dependency/ https://howtodoinjava.com/junit/junit-6-maven-dependency/#respond <![CDATA[Lokesh Gupta]]> Mon, 01 Dec 2025 08:30:45 +0000 <![CDATA[Junit]]> <![CDATA[JUnit 6]]> https://howtodoinjava.com/?p=42636 <![CDATA[

Learn to configure JUnit 6 maven dependencies by including the mandatory junit-jupiter-engine along with optionals such as the API, params, and platform components.

The post JUnit 6 Maven Dependency appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/junit/junit-6-maven-dependency/feed/ 0
JUnit 6 Tutorial with Examples https://howtodoinjava.com/junit/junit-6-tutorial/ https://howtodoinjava.com/junit/junit-6-tutorial/#respond <![CDATA[Lokesh Gupta]]> Mon, 01 Dec 2025 08:04:43 +0000 <![CDATA[Junit]]> <![CDATA[JUnit 6]]> https://howtodoinjava.com/?p=42629 <![CDATA[

JUnit 6 is a modern, polished evolution of JUnit 5 that embraces Java 17+, improves extension handling, enhances performance, and adds new features like nullability annotations and native Kotlin coroutine support.

The post JUnit 6 Tutorial with Examples appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/junit/junit-6-tutorial/feed/ 0
Spring AI Custom CallAdvisor & StreamAdvisor Example https://howtodoinjava.com/spring-ai/spring-ai-calladvisor-streamadvisor-example/ https://howtodoinjava.com/spring-ai/spring-ai-calladvisor-streamadvisor-example/#respond <![CDATA[Lokesh Gupta]]> Mon, 16 Jun 2025 20:43:48 +0000 <![CDATA[Spring AI]]> https://howtodoinjava.com/?p=42607 <![CDATA[

Spring AI CallAdvisor and StreamAdvisor provide hooks to wrap around LLM invocations, both for synchronous and streaming scenarios.

The post Spring AI Custom CallAdvisor & StreamAdvisor Example appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/spring-ai/spring-ai-calladvisor-streamadvisor-example/feed/ 0
Selenide IllegalArgumentException: Failed to create folders https://howtodoinjava.com/java/exception-handling/selenide-illegalargumentexception-failed-to-create-folders/ https://howtodoinjava.com/java/exception-handling/selenide-illegalargumentexception-failed-to-create-folders/#respond <![CDATA[Lokesh Gupta]]> Mon, 17 Feb 2025 10:42:41 +0000 <![CDATA[Java Exception Handling]]> <![CDATA[Selenium]]> https://howtodoinjava.com/?p=42557 <![CDATA[

The error "java.lang.IllegalArgumentException: Failed to create folder" in Selenide typically happens when Selenide tries to save screenshots, page sources, or logs, but it cannot create the required directories due to permission issues or incorrect paths.

The post Selenide IllegalArgumentException: Failed to create folders appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/java/exception-handling/selenide-illegalargumentexception-failed-to-create-folders/feed/ 0
Angular UI Testing using Selenium and Selenide https://howtodoinjava.com/java/angular-ui-testing-using-d-selenide/ https://howtodoinjava.com/java/angular-ui-testing-using-d-selenide/#respond <![CDATA[Lokesh Gupta]]> Mon, 17 Feb 2025 08:39:53 +0000 <![CDATA[Java]]> <![CDATA[Selenium]]> <![CDATA[UI Testing]]> https://howtodoinjava.com/?p=42554 <![CDATA[

In-browser UI testing of Angular applications poses several challenges such as asynchronous operations and unpredictable loading screens with spinners or dimmers.
Selenide has an implicit capability to wait for the loading screen to disappear.

The post Angular UI Testing using Selenium and Selenide appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/java/angular-ui-testing-using-d-selenide/feed/ 0
How to Fix MySQL Innodb_Force_Recovery Not Working Issue? https://howtodoinjava.com/sql/fix-mysql-innodb_force_recovery-not-working-issue/ https://howtodoinjava.com/sql/fix-mysql-innodb_force_recovery-not-working-issue/#respond <![CDATA[Lokesh Gupta]]> Tue, 11 Feb 2025 10:53:49 +0000 <![CDATA[SQL]]> https://howtodoinjava.com/?p=42549 <![CDATA[

When InnoDB tables become corrupted, the InnoDB storage engine typically crashes the MySQL server to prevent further damage. In such situations, you can use the innodb_force_recovery option to force the server to start despite the corruption. However, you may face a situation where the innodb_force_recovery fails to start the server. This issue can occur for ... Read more

The post How to Fix MySQL Innodb_Force_Recovery Not Working Issue? appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/sql/fix-mysql-innodb_force_recovery-not-working-issue/feed/ 0
JPackage : Create MSI/EXE Installer for Java App https://howtodoinjava.com/devops/jpackage-plugin-example/ https://howtodoinjava.com/devops/jpackage-plugin-example/#respond <![CDATA[Lokesh Gupta]]> Thu, 06 Feb 2025 06:54:41 +0000 <![CDATA[DevOps]]> <![CDATA[Create Installer]]> <![CDATA[JPackage]]> https://howtodoinjava.com/?p=42542 <![CDATA[

The jpackage is a command-line tool introduced in Java 14 and helps create native installable packages (.exe, .msi, .dmg, .pkg, .deb, .rpm) for Windows, macOS, and Linux. Jpackage bundles Java applications along with a Java runtime (JRE) image, ensuring that end users do not need to install Java separately.

The post JPackage : Create MSI/EXE Installer for Java App appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/devops/jpackage-plugin-example/feed/ 0
How to Use DBCC CHECKDB to Check the Integrity Check in SQL DB https://howtodoinjava.com/sql/db-integrity-checks-using-dbcc-checkdb/ https://howtodoinjava.com/sql/db-integrity-checks-using-dbcc-checkdb/#respond <![CDATA[Lokesh Gupta]]> Sat, 18 Jan 2025 09:12:52 +0000 <![CDATA[SQL]]> <![CDATA[Database Tools]]> https://howtodoinjava.com/?p=42521 <![CDATA[

Database integrity refers to the accuracy, consistency, and reliability of the data stored within a database. It ensures that data remains uncorrupted, and adheres to defined rules. In SQL databases, integrity is supported through constraints like primary keys, foreign keys, unique constraints, and check constraints, alongside physical and logical data structure maintenance. Designed as a ... Read more

The post How to Use DBCC CHECKDB to Check the Integrity Check in SQL DB appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/sql/db-integrity-checks-using-dbcc-checkdb/feed/ 0
TypeScript Array of Objects https://howtodoinjava.com/typescript/typescript-array-of-objects/ https://howtodoinjava.com/typescript/typescript-array-of-objects/#respond <![CDATA[Lokesh Gupta]]> Mon, 16 Dec 2024 07:50:33 +0000 <![CDATA[TypeScript]]> <![CDATA[TypeScript Array]]> https://howtodoinjava.com/?p=42492 <![CDATA[

In TypeScript, an array of objects is a collection of items where each item is an object. Arrays of objects are commonly used to organize complex data structures, such as user information, products, or any other entity, into manageable collections.

The post TypeScript Array of Objects appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/typescript/typescript-array-of-objects/feed/ 0
TypeScript Array of Vectors: Multi-dimensional Arrays https://howtodoinjava.com/typescript/typescript-array-of-vectors/ https://howtodoinjava.com/typescript/typescript-array-of-vectors/#respond <![CDATA[Lokesh Gupta]]> Mon, 16 Dec 2024 06:53:08 +0000 <![CDATA[TypeScript]]> <![CDATA[TypeScript Array]]> https://howtodoinjava.com/?p=42487 <![CDATA[

In TypeScript, an array of vectors is a collection of vectors, where each vector can represent an array of numbers or custom objects. This multi-dimensional array structure is handy in scenarios such as mathematical computations, graphics programming, or handling grouped data in a type-safe and organized manner.

The post TypeScript Array of Vectors: Multi-dimensional Arrays appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/typescript/typescript-array-of-vectors/feed/ 0
Java Generate PDF from HTML Template using OpenHtmlToPdf https://howtodoinjava.com/java/library/convert-html-template-to-pdf/ https://howtodoinjava.com/java/library/convert-html-template-to-pdf/#respond <![CDATA[Lokesh Gupta]]> Mon, 09 Dec 2024 07:37:47 +0000 <![CDATA[Java Libraries]]> <![CDATA[Open Source]]> <![CDATA[PDF]]> https://howtodoinjava.com/?p=42406 <![CDATA[

OpenHTMLToPDF library generates PDF from HTML and CSS content taken from templates such as HTML file, Freemarker and Thymeleaf templates.

The post Java Generate PDF from HTML Template using OpenHtmlToPdf appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/java/library/convert-html-template-to-pdf/feed/ 0
Spring Boot Structured Logging in JSON Format Example https://howtodoinjava.com/spring-boot/structured-logging-example/ https://howtodoinjava.com/spring-boot/structured-logging-example/#respond <![CDATA[Lokesh Gupta]]> Mon, 18 Nov 2024 12:26:13 +0000 <![CDATA[Spring Boot]]> <![CDATA[Spring Boot Logging]]> <![CDATA[Structured Logging]]> https://howtodoinjava.com/?p=42335 <![CDATA[

Since version 3.4, Spring Boot will provide native support for structured logging in the most common and popular formats, such as JSON and XML.

The post Spring Boot Structured Logging in JSON Format Example appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/spring-boot/structured-logging-example/feed/ 0
Spring Security Two-Factor Auth (2FA) with JWT Token https://howtodoinjava.com/spring-security/2fa-auth-with-jwt-token/ https://howtodoinjava.com/spring-security/2fa-auth-with-jwt-token/#respond <![CDATA[Lokesh Gupta]]> Tue, 12 Nov 2024 12:21:08 +0000 <![CDATA[Spring Security]]> <![CDATA[Authentication]]> <![CDATA[JWT]]> <![CDATA[One-Time Token]]> https://howtodoinjava.com/?p=42317 <![CDATA[

Creating REST APIs is a better approach for building one-time token-based authentication combined with Jwt tokens in Spring Security.

The post Spring Security Two-Factor Auth (2FA) with JWT Token appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/spring-security/2fa-auth-with-jwt-token/feed/ 0
Python Read File Line by Line (with Examples) https://howtodoinjava.com/python/read-file-line-by-line-examples/ https://howtodoinjava.com/python/read-file-line-by-line-examples/#respond <![CDATA[Lokesh Gupta]]> Sat, 05 Oct 2024 19:58:20 +0000 <![CDATA[Python]]> <![CDATA[Python IO]]> <![CDATA[Read a File]]> https://howtodoinjava.com/?p=42248 <![CDATA[

Python provides several ways to read a text file and process its lines sequentially or randomly. The correct method to use depends on the size of the file (large or small) and the ease of desired syntax. In this Python tutorial, we will discuss different approaches based on their clean syntaxes, ability to read large ... Read more

The post Python Read File Line by Line (with Examples) appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/python/read-file-line-by-line-examples/feed/ 0
How to Remove Orphan Entities in Hibernate? https://howtodoinjava.com/hibernate/orphan-removal-example/ https://howtodoinjava.com/hibernate/orphan-removal-example/#respond <![CDATA[Lokesh Gupta]]> Fri, 04 Oct 2024 10:22:03 +0000 <![CDATA[Hibernate]]> <![CDATA[Hibernate Basics]]> https://howtodoinjava.com/?p=42240 <![CDATA[

In Hibernate, an orphan entity refers to a child entity that has been disassociated from its parent. If these orphan entities are not explicitly removed, they remain in the database and result in unwanted data. The orphanRemoval = true attribute on the mapping annotation on parent entity automatically removes the child entities from the database ... Read more

The post How to Remove Orphan Entities in Hibernate? appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/hibernate/orphan-removal-example/feed/ 0
How to Save Child Entities using Hibernate? https://howtodoinjava.com/hibernate/automatically-save-child-entities/ https://howtodoinjava.com/hibernate/automatically-save-child-entities/#respond <![CDATA[Lokesh Gupta]]> Fri, 04 Oct 2024 09:29:29 +0000 <![CDATA[Hibernate]]> <![CDATA[JPA Cascading]]> https://howtodoinjava.com/?p=42235 <![CDATA[

One of the most essential concepts in Hibernate is working with parent-child entity relationships, where a parent entity contains references to one or more child entities. To ensure that we are saving/updating the child entities (along with the parent entity), we depend on the correct usage of annotations like @OneToOne, @OneToMany, @ManyToMany, @JoinColumn, and cascade ... Read more

The post How to Save Child Entities using Hibernate? appeared first on HowToDoInJava.

]]>
https://howtodoinjava.com/hibernate/automatically-save-child-entities/feed/ 0