Spring Data ‘LIKE’ Query with JdbcClient or JpaRepository
Learn to write SQL queries with ‘LIKE’ keyword in a Spring Boot JPA application and execute with JdbcClient, JdbcTemplate or JpaRepository template methods.
Learn to write SQL queries with ‘LIKE’ keyword in a Spring Boot JPA application and execute with JdbcClient, JdbcTemplate or JpaRepository template methods.
Since Spring 6.1, JdbcClient provides a unified client API for JDBC query and update operations, offering a more fluent and simplified interaction model.
Learn to configure the Log4j2 provided JDBCAppender that writes log events to a relational database table using standard JDBC. The JDBCAppender obtains the database connection from a configured connection factory or JNDI datasource. Then it uses the provided column configuration to insert a new row in the log table, everytime a log statement is executed. … Read more
If you are working on Hibernate and HSqlDB, and you are trying to fetch collection of entities, then you may face this error. For single entity you may or may not find this error. Exception will look like this: Solution This error is due to version mismatch of hibernate and hsqldb. Trying updating latest verion … Read more
Using custom SQL scripts in spring to initialize the database at startup of application with appropriate tables and data populated inside it.
The Hibernate Search module works as a bridge between Hibernate ORM and full-text search engines such as Lucene or Elasticsearch. While performing a search, it enables us to work with JPA entities, and in the background, it transparently works with Lucene to provide a consistent experience. This Hibernate search guide will discuss the core concepts … Read more
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 with the H2 database and … Read more
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.
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. Let us see a quick … Read more
Learn to read all the rows from an Excel (.xls or .xlsx) file using Spring Batch and save them in a database in a Spring Boot application.
Learn to Spring Data JPA module and work with JpaRepository interface for performing the CRUD operations in underlying databases in a Spring Boot application.
Spring Boot provides various ways to load property files such as default application.properties, spring profiles, custom property files, environment variables, and system properties.
SpringExtension integrates the Spring TestContext Framework into JUnit 5 Jupiter extension model, sets up the ApplicationContext, and manages dependencies.
This guide explores the step-by-step process of containerization and running a Spring Boot application with PostgreSQL database using Podman.
This Spring vs. Spring Boot tutorial lists the differences between Spring framework and Spring Boot based on general characteristics and features.
Java records cannot be used as the replacement for JPA entities because they restrict the byte code manipulation, generally required by frameworks to work.
Learn to use Spring CrudRepository and ListCrudRepository interfaces, their differences and the changes made in Spring Data 3.0 with examples.
Learn to build REST APIs in a Spring boot application with request validation, error handling, testing and API documentation with examples.
Vaadin is a Java framework that simplifies front-end development by providing a rich set of reusable UI components and layouts. In this Spring Boot and Vaadin tutorial, we will explore the process of developing a basic CRUD application. 1. Goals Our goal is to construct a user interface that includes a table displaying the list … Read more
Learn the core concepts of configuring role-based authorization in Spring Security 6 and implementing authorization in a Spring Boot application.
Since Spring Boot 3.1, @ServiceConnection is used to provide connection details to a remote service that takes precedence over details in the properties file.
Learn to use Spring boot docker compose module, customize the compose file and container lifecycle with an example.
Learn the fundamentals of working with S3 buckets and objects using Spring Cloud AWS library and its S3Client and S3Template classes.
If you’re preparing for a job interview, these Spring security interview questions will help you understand key concepts and increase the confidence.
Learn to use Redis Pub/Sub with Spring Boot Data, and configure the message publishers and subscribers (listners) for a given channel topic.
After WebSecurityConfigurerAdapter was first deprecated and then removed in Spring Security 6, this tutorial will help in migrating to the latest version.
In Spring security tutorial, learn how it works under the hood, concepts of authentication, authorization, access control and basic configurations.
Step by step, we will learn to deploy a Spring Boot application to AWS Elastic Beanstalk which uses RDS for persisting the records in the database.
Learn the installation of the Keycloak authorization server as a docker container and different configurations for setting up the realm and testing the authorization token flow.
Learn to implement authentication with a user login and logout functionality using Vue.js and Spring Boot Security using JWT tokens.
Spring @Sql executes DDL and DML SQL scripts and statements during the integration testing. @SqlGroup groups multiple @Sql statements.
Learn to execute SQL scripts to load data (e.g. import.sql, schema.sql or data.sql) during startup of a Spring boot application or tests.
Learn to solve the ‘JdbcSQLSyntaxErrorException schema not found’ error in a Spring boot app that uses the H2 database for CRUD operations.
In this post, we will learn how to configure and manage multiple datasources using properties configuration and defining custom beans using Java annotations in Spring Boot. Note that this requirement differs from having separate datasource in test, dev and prod environments. Here, we are using multiple datasources in the same environment and each datasource can … Read more
Learn to configure and use different DataSource in different environments (test, development, production etc.) using the Spring profile specific properties files, as well as Java configuration in a Spring boot application. 1. Introduction A production grade application is deployed and tested in different environments before finally released to the end-user. In these environments, application must … Read more
Learn to install the database services such as MySQL and PostgreSQL as docker containers and connect to them from Adminer or Spring boot app.
Learn to perform integration testing using Testcontainers and JUnit 5 in a Spring boot application, including creating a @ServiceConnection.
Learn how to enable SQL logging in a Spring boot Data JPA application, print SQL statements and prepare statements with parameter values.
Learn to configure MyBatis with Spring Boot 3 and configure @Mapper and DataSource. Also, learn mapper scanning with @MapperScan with example.
In this Spring boot with Angular tutorial, learn to create REST APIs using Spring boot and call from Angular to create a CRUD application.
Spring batch is a lightweight, comprehensive framework designed for the development of robust batch processing applications. Learn with examples.
This guide lists out a few of the most asked SQL interview questions and gives their answers such as JOINS, KEYWORDS, TRIGGERS and much more.
On this page, we will frequently list the major feature changes in the latest Java release, sequentially. Though we have tried to cover as much information as possible, if you know something we have missed below, please let me know, and we will add that information. Java 22 Features Java 22 has been released on … Read more
Learn about Spring profiles, @Profile, profile-specific beans and properties, profile groups and activating a certain profile during startup.
Learn to use @PropertySource, @Value and @ConfigurationProperties annotations to register property files and inject configuration properties.
Learn to configure OAuth2 authorization-based login security in a Spring boot and spring security application with custom handlers.
Learn to configure and test a spring security login form based authentication that fetches the username, password and roles from the database.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.