My Articles:
Schedule jobs in Spring Boot 4 with Quartz 2.5: inject Spring beans into jobs, use simple and cron triggers, handle misfires, chain jobs with listeners, persist and cluster jobs with the JDBC job store, and manage them from the actuator endpoint.
Connect Spring Boot 4.1 to Elasticsearch 9 with Spring Data Elasticsearch 6.1 and the new Java client: run Elasticsearch in Docker, map documents, search with repositories and NativeQuery, and test with Testcontainers.
A hands-on Kubernetes guide for Java developers: deploy a Spring Boot API and PostgreSQL to a local kind cluster and learn pods, Deployments, Services, Ingress, ConfigMaps, Secrets, volumes and StatefulSets with real kubectl output.
Upload an .xlsx class roster to a Spring Boot endpoint, read it with Apache POI, validate every row with Bean Validation and save the valid rows in JDBC batches. Includes a JSON error report, duplicate checks, a SAX reader for large files with measured heap, upload limits and MockMvc tests.
Set up Hibernate 7.4 in a Spring Boot 4.1 application: the JPA starter, datasource and JPA properties, entities, Spring Data repositories, transactions, the Session API, SQL logging, tests on H2 and MySQL, and the Hibernate 7 upgrade changes.
A shared Random is thread-safe but makes every thread fight over one seed. Learn which generator each thread should use, how to keep seeded results reproducible, and what a JMH benchmark measured on Java 25.
Spring Boot @Autowired connects the classes together without tight coupling, making application modular, testable, and easy to maintain.
Learn to fix MySQL error #1194 (“Table is marked as crashed”) with Stellar Repair for MySQL. Read this detailed guide for step-by-step repair process. Discover how to quickly restore corrupted MySQL tables with minimal data loss.
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.
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.
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.
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.
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.
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.
Spring AI CallAdvisor and StreamAdvisor provide hooks to wrap around LLM invocations, both for synchronous and streaming scenarios.
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.
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.
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. …
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.
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 …
Declare a typed array of objects with an interface or type alias, then add, find, filter, sort, group and update its objects without surprises.
TypeScript has no Vector class. Model each vector as a tuple such as [x: number, y: number, z: number], store them in an array, and do vector math with typed functions.
OpenHTMLToPDF library generates PDF from HTML and CSS content taken from templates such as HTML file, Freemarker and Thymeleaf templates.
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.
Creating REST APIs is a better approach for building one-time token-based authentication combined with Jwt tokens in Spring Security.
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 …
orphanRemoval = true deletes a child entity as soon as it leaves its parent’s association. See the SQL Hibernate 7 runs, how it differs from CascadeType.REMOVE, and the common mistakes.
Save a parent and its child entities with one persist() call in Hibernate 7. See cascade PERSIST and MERGE, the helper method that sets both sides, managed and detached parents, getReference(), and the real SQL and errors.
This short Logback tutorial lists examples for configuring logback.xml to log messages to both the console and/or file appenders. 1. Logback Dependencies To include Logback, include the latest version of logback-classic dependency, which transitively includes all the necessary dependencies, including SLF4J. Spring Boot comes with SLF4J and Logback as the …
Add full-text search to a Spring Boot 4 application with Hibernate Search 8.4 and Lucene: map the entity, register the analyzer as a Spring bean, index existing rows on ApplicationReadyEvent, and expose a paged, sorted REST search endpoint tested with MockMvc.
1. Problem When writing tests that depend on H2 database in a Spring boot application, we may encounter the CommandAcceptanceException: Error executing DDL. The root cause exception will be org.h2.jdbc.JdbcSQLSyntaxErrorException in the logs. The exception stack trace will look something like this: If you are trying to run unit tests …
Learn to configure log4j2.yaml file to output the log statements to the console, rolling files, etc. Also, learn to configure log4j2 appenders, levels, and patterns.
Learn to make HTTP GET requests (sync and async) using Spring Boot WebClient, pass URI and query params, handle responses, and handle errors.
As a best practice in Java, POJO classes or Data objects always declare the fields private and expose their access through the getter methods. On rare occasions, we may encounter situations when the member fields are private, and the class does not provide the public accessor methods. For example, the …
In Spring Security, a One-Time Token (OTT) is a server-side generated string that can be used only once for user login authentication purpose.
Learn to configure Postgres PgVectorStore to store the vectors generated with OpenAI and Ollama embedding models in a Spring AI project.
Learn to build a fully-functional chatbot application (with UI) with RAG (Retrieval-Augmented Generation) capabilities using Spring AI and Spring Web.
In Spring AI, function calling is the ability for the model to request one or more function calls to be made on its behalf by the ChatBot application.
Learn to download, install, and run an LLM model using Ollama. Also learn to configure Spring AI Ollama module to access the model’s chat API.
Inspired by LangChain4j and LlamaIndex, Spring AI project aims to streamline the development and integration of AI capabilities into existing or new Spring applications.
LLMs are quite good at producing the source code when they are provided enough context information and asked very clear questions. The same is true for generating SQL queries when they are provided the table/column information through DDL statements, and clear instructions of output format of the generated SQL statements. …
For creating an ETL pipeline for Spring AI data ingestion microservice, Spring cloud functions are an excellent choice for serverless providers.
The ETL pipeline ingest raw data sources (text, JSON/XML, audio, video, etc.) to a structured vector store for similarity searches using Spring AI.
In Spring AI, the role of a vector database is to store vector embeddings and facilitate similarity searches for these embeddings. Learn with examples.
In Spring AI Vector Embedding tutorial, learn what is a vector or embedding, how it helps in semantic searches, and how to generate embeddings using OpenAI.
Spring AI currently supports only OpenAI’s whisper model for speech transcription to JSON or TEXT files using OpenAiAudioTranscriptionModel class.
In Spring AI, SpeechModel and StreamingSpeechModel interfaces allow to interact with Text-to-Speech APIs of supported LLMs such as tts-1 by OpenAI.
In Spring AI PromptTemplate example, learn different message roles and how they are used to create prompts and send them to the AI models.
Learn to create an immutable or unmodifiable Map using the factory methods added in Java 9 and other versions (Java 8 to Java 21) with examples.
In Java, we can serialize an object to String in different ways such as converting to byte[] and thenBase64 encoded string, XML or JSON. Learn with examples.