Category: Spring Boot
-
How to use Lombok with Spring Boot
Project Lombok is one of those libraries that a lot of developers appreciate. Not only because it saves you a lot of time writing boilerplate code, but you also end up with leaner and cleaner code which is easier and more pleasant to read. If you are considering to introduce Lombok to your project, then…
-
Spring Boot and Docker example on Windows
In this tutorial, we will discuss how to create a docker container from a Spring Boot application and how to run it in a Windows environment. Most of the tutorials I encountered related to creating Spring Boot containers were focused on Linux, so I thought I would share my experience creating docker containers of your…
-
How to configure sharding with Lucene, Hibernate search & Spring Boot
In this guide, we will explore how to implement sharding with Lucene and Hibernate Search in a Spring boot and JPA environment. We will discuss why is it useful and when is it a good idea to implement it. I would also suggest that you read our guide here if you are just getting started with…
-
Spring boot and Lucene configuration example
In this tutorial, we will set up a Spring boot application to use Hibernate search with a Lucene indexing backend. This tutorial assumes that you already have a working Spring boot application with JPA/Hibernate configured. Please check out our tutorial “Getting started with Spring boot 2 and JPA” if you are new to Spring boot and…
-
Auditing using Spring boot, MongoDB and JaVers
In this tutorial, we will discuss how to audit data and generating audit logs and data history entries using JaVers in a Spring boot and MongoDB environment. Prerequisites If you currently do not have a Spring boot environment set up with a MongoDB backend, then we suggest that you check out our Spring boot and MongoDB…
-
Spring boot and MongoDB configuration example
In this post, we will configure a Spring boot application to use a MongoDB persistence back-end. BTW, if you are developing on a Windows machine, then you can also check out our guide for how to install and get started with MongoDB on Windows. Introduction MongoDB is a NoSQL, cross-platform, document based database engine. It…
-
Prototype vs Singleton Spring Beans – How-to, Differences and Uses
In this post, we will discuss two different types of Spring beans, namely singleton and prototype beans. We will also discuss when is it preferred to use prototype beans and when to use singleton beans. Singleton beans Most beans that you will use or encounter are singleton beans. Singleton beans are initialized only once. Either…
-
How to obtain application property values in a Spring Boot application
In this guide, we will discuss two ways to obtain application property configuration values inside a Spring boot application. We will focus on properties that are loaded via an application.properties or an application.yml file. But all loaded properties in your application context should also be obtainable via the discussed methods. We will discuss the @Value…
-
How to configure Spring beans using constructor injection
In this post, we will focus on configuring Spring beans in a Spring-boot environment using Java configuration and constructor injection. This example should be valid for Spring version 4.3 and later. Let us start by discussing a couple of basic concepts. What is constructor injection? Constructor injection is the process of injecting Spring dependencies into…
-
Configuring and mapping database tables to JPA entities
In this post, we will explore how to map a database tables to JPA Entities. In our example, we will use a Spring Boot environment, JPA 2.2 and Hibernate 5.3.7 . However, the information presented here should apply to any environment with a JPA version of 2.1 or later. Introduction In our previous post, we discovered…