Log4j2 JDBCAppender

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

Spring Batch + Quartz + H2 Jdbcjobstore Example

Learn to execute multiple Spring batch jobs using quartz scheduler and persistent database storage recording used by quartz to record jobs and trigger information. I am using H2 database with web console enabled to view data in DB tables. You can select DB as per your requirement.

Spring Boot @ServiceConnection

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.

Spring Security Interview Questions

If you’re preparing for a job interview, these Spring security interview questions will help you understand key concepts and increase the confidence.

Redis Pub/Sub with Spring Boot Data

Learn to use Redis Pub/Sub with Spring Boot Data, and configure the message publishers and subscribers (listners) for a given channel topic.

Spring Security Tutorial

In Spring security tutorial, learn how it works under the hood, concepts of authentication, authorization, access control and basic configurations.

Getting Started with Keycloak on Docker

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.

Configure Multiple DataSources in Spring Boot

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

Spring Boot – Separate DataSource for Test, Dev and Prod

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

Spring Batch Tutorial

Spring batch is a lightweight, comprehensive framework designed for the development of robust batch processing applications. Learn with examples.

SQL Interview Questions with Answers

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.

Java Versions and Features

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 18 Features Java 18 GA was released on … Read more

Guide to Spring Boot Profiles

Learn about Spring profiles, @Profile, profile-specific beans and properties, profile groups and activating a certain profile during startup.

Password Encoders in Spring Security

Learn the contract spring security expects from PasswordEncoder interface, inbuilt implementations and DelegatingPasswordEncoder with examples.

Java Logging

This Java logging series lists down all tutorials posted under logging frameworks such as Log4j2 and Logback, for quick references.

Log4j2 Tutorial

Log4j2 provides significant improvements over its predecessor Log4j. Read about its xml and properties configuration and various examples.

Hibernate Tutorials

These tutorials have been published to help you start with persistence with Hibernate and JPA. These are updated to version Hibernate 6.x.

Mocking an In-memory JNDI DataSource

Learn to create and inject an in-memory DataSource that can be used to mock J2EE container provided JNDI DataSource without running a server.

Batch Processing with Hibernate/JPA

Learn to execute bulk SQL INSERT and UPDATE statements using Hibernate / JPA batch processing, and to configure session-specific batch sizes.

Stored Procedures with Hibernate

Hibernate provides support for executing the stored procedures and capturing their outputs using StoredProcedureQuery and ProcedureCall APIs.

Guide to Pagination with Hibernate

Learn to implement and test the pagination functionality in hibernate using the HQL setFirstResult(), setMaxResults() and ScrollableResults.

Testing Web, Service and Dao Layers in Spring Boot

Learn how to test a Spring boot web application. We will see some very quick examples (using Junit 5) and configurations for : For demo purposes, we have created a very simple Employee management application. It has a few CRUD API calls for creating, fetching and deleting the employees from the database. Do not forget … Read more

Spring Boot HATEOAS

Learn to build hateoas links for REST resources using RepresentationModel and RepresentationModelAssemblerSupport in a Spring boot application example.

Spring Batch Partitioning into Multiple Steps

Learn to use Spring batch partitioning to use multiple threads to process a range of data sets in a spring boot application. 1. Parallel Processing and Step Partitioning 1.1. Parallel Processing Mostly batch processing problems can be solved using a single-threaded, but a few complex scenarios like single-threaded processing taking a long time to perform … Read more

Spring Boot @DataJpaTest

Spring boot @DataJpaTest annotation focuses on JPA components and apply configuration only relevant to JPA tests. It helps in testing @Repository classes.

@Repository Annotation in Spring Boot

Spring boot @Repository annotation is a specialization of the @Component to indicate a data repository used for storage, retrieval, and search behavior.

Spring Boot Interview Questions

Spring boot makes application development easier but we may face some tough interview questions when it comes to test your knowledge on how it all works. Be prepare for the next job interview with given Spring boot interview questions and answers.

Spring Boot DataSource Configuration

Learn how to create and customize DataSource bean in Spring boot applications and configure connection pooling and multiple datasource beans.

Spring annotations

Learn about the most widely used spring annotations. In this tutorial, we will briefly cover the important annotations which are provided by spring core to define beans and create complex application context configurations. 1. Bean annotations Given list of annotations are used to define beans in spring and to control their registration preferences in application … Read more

About Us

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.