How to Test the @Scheduled Annotation 1. Introduction One of the available annotations in the Spring Framework is @Scheduled. We can use this annotation to execute tasks in a scheduled way. In this tutorial, we’ll explore how to test the @Scheduled annotation. 2. Dependencies First, let’s start creating a Spring Boot Maven-based application… Continue Reading spring-testing-scheduled-annotation

A Quick Guide to @TestPropertySource  1. Overview Spring brings many features to help us with testing our code. Sometimes we need to use particular configuration properties in order to set up the desired scenario in our test cases. In these situations, we can make use of the @TestPropertySource annotation. With this… Continue Reading spring-test-property-source

Spring Persistence (Hibernate and JPA) with a JNDI datasource Persistence Spring 1. Overview In this article, we’ll create a Spring application using Hibernate/JPA with a JNDI data source. If you want to read discover Spring and Hibernate basics, check out this article. 2. Defining a Datasource 2.1. System Since we’re… Continue Reading spring-persistence-hibernate-and-jpa-with-a-jndi-datasource

Setting Up Swagger 2 with a Spring REST API 1. Overview When creating a REST API, good documentation is instrumental. Moreover, every change in the API should be simultaneously described in the reference documentation. Accomplishing this manually is a tedious exercise, so automation of the process was inevitable. In this… Continue Reading swagger-2-documentation-for-spring-rest-api

Warning: “The type WebMvcConfigurerAdapter is deprecated” 1. Introduction In this quick tutorial, we’ll have a look at one of the warnings we may see when working with a Spring 5.x.x version, namely the one referring to the deprecated WebMvcConfigurerAdapter class. We’ll see why this warning happens and how to handle… Continue Reading web-mvc-configurer-adapter-deprecated

Error Handling for REST with Spring 1. Overview This article will illustrate how to implement Exception Handling with Spring for a REST API. We’ll also get a bit of historical overview and see which new options the different versions introduced. Before Spring 3.2, the two main approaches to handling exceptions… Continue Reading exception-handling-for-rest-with-spring