Spring Boot

In this short tutorial, you will learn how to use SearchPaths to configure your Spring Cloud Config Server to discover properties files in remote Git repository subdirectories. To learn how to configure Spring Cloud Config Server and also Spring Cloud Config Client, please read this tutorial: Learn to use Spring Cloud Config Server and Spring Cloud…

Read More Spring Cloud Config Server – SearchPaths

This tutorial will teach you how to bind nested properties from the application.properties file to a Java class. Once you finish this tutorial, you might also want to check: How to bind simple(not nested) properties to a Java class, and How to use @ConfigurationProperties with Spring Boot @Profile. Example of Nested Properties in a Properties File…

Read More Spring Boot Nested Properties with @ConfigurationProperties

@ConfigurationProperties annotation is used to bind all the properties in a properties file to a Java class. You can then use an object of the Java class annotated with ConfigurationProperties annotation to access configuration properties defined in a properties file. Earlier I shared with you a tutorial on how to read application properties in Spring Boot RESTful…

Read More Spring Boot @ConfigurationProperties Tutorial

In this tutorial, you will learn how to use Spring Cloud Bus to notify running Microservices about the changes in the Spring Cloud Config property file. Running Microservices will be updated with new properties stored in Spring Cloud Config file without the need for you to restart them. This way you can update values in…

Read More Spring Cloud Bus – Refreshing Config Changes

In this short Spring Boot tutorial, you will learn how to pass command-line arguments to your Spring Boot application. Passing Command-Line Arguments To pass command line arguments to your Spring Boot app when running it with Maven use the -Dspring-boot.run.arguments. In the below code example, I will pass two command-line arguments: firstName and lastName. mvn spring-boot:run…

Read More Pass Command-Line Arguments to Spring Boot Application

In this tutorial, you will learn how to read HTTP Request Header in the Rest Controller class of your Spring Boot application. To read HTTP Request Header in Spring Boot REST application, we use @RequestHeader annotation. @RequestHeader(value=”Accept”) String acceptHeader To learn how to test if HTTP Header is received, read the tutorial about Testing HTTP Header…

Read More Read HTTP Request Header in Spring Boot REST

In this tutorial, I will share how to make the Spring Boot application display Hibernate SQL Queries. If you are learning about Hibernate, you might also be interested in the following tutorials: One-to-One Mapping Hibernate/JPA Using Spring Boot and MySQL One-to-Many Mapping Hibernate/JPA Using Spring Boot and MySQL Many-to-Many Relationship in Spring Boot Rest +JPA…

Read More Show Hibernate SQL Query in Spring Boot

In this blog post, I am going to list commonly used POM.XML dependencies for building RESTful Web services with Spring Boot and Spring MVC. The list of below dependencies is not complete and will depend on the functionality you need your RESTful Web Services to support. But if you are building a simple REST API…

Read More Common POM.XML Dependencies for RESTful Web Services

The list of below video tutorials is a Quick Start to learning How to Build RESTful Web Services with Spring Framework. Spring Framework is large and there is so much to learn about it. And although there are so many tutorials on the Internet I still felt it would be helpful to create a series…

Read More RESTful Web Services with Spring Framework. Video Tutorials

In this tutorial, you will learn how to make a method in your Rest Controller class return a custom HTTP status code. To return a specific HTTP status code from a Spring Controller method in your application, you can use the ResponseEntity class. ResponseEntity with HTTP Status Code Let’s assume we have a simple web…

Read More Return Custom HTTP Status from Spring Controller

In this short tutorial, I am going to share with you how to enable CrossOrigin in a RESTful Web Service API built with Spring Boot that also has Spring Security enabled. Enable CrossOrigin for Specific Endpoint  To enable cross-origin AJAX HTTP requests to a specific RESTful Web Service endpoint in our Rest Controller class we can use…

Read More CrossOrigin and CORS in RESTful Web Service

In this tutorial, we will create a Spring Boot application which demonstrates how we can add and use the H2 in-memory database in our application. You will learn how an in-memory database like H2 can be used to develop a Spring boot application without the overhead of doing DB configuration on your machine and without…

Read More Using H2 In-memory Database in Spring Boot

With this Spring Boot tutorial, I will share how to handle exceptions in your RESTful Web Service application build with Spring Boot. Read the “Handling Exceptions in Project Reactor” tutorial if you use a project reactor. And to learn how to test your code for Exceptions, read the “Test for Exceptions with the JUnit” tutorial. What…

Read More Handle Exceptions in Spring Boot RESTful Service