A Guide to Spring Boot Configuration Metadata 1. Overview When writing a Spring Boot application, it’s helpful to map configuration properties onto Java beans. What’s the best way to document these properties, though? In this tutorial, we’ll explore the Spring Boot Configuration Processor and the associated JSON metadata files that… Continue Reading spring-boot-configuration-metadata

Validation in Spring Boot 1. Overview When it comes to validating user input, Spring Boot provides strong support for this common, yet critical, task out of the box. Although Spring Boot supports seamless integration with custom validators, the de-facto standard for performing validation is Hibernate Validator, the Bean Validation framework’s… Continue Reading spring-boot-bean-validation

Generate Spring Boot REST Client with Swagger 1. Introduction In this article, we’ll use the Swagger CodeGen project to generate a REST client from an OpenAPI/Swagger spec file. Also, we’ll create a Spring Boot project, where we’ll use generated classes. We’ll use the Swagger Petstore API example for everything. 2.… Continue Reading spring-boot-rest-client-swagger-codegen

Create a Fat Jar App with Spring Boot 1. Introduction One of the more heart-warming developments of recent years has been an ongoing simplification of how web applications are deployed. Skipping all the boring intermediate historical steps, we arrive at today – when we can dispense with not only cumbersome… Continue Reading deployable-fat-jar-spring-boot

Guide to ApplicationContextRunner in Spring Boot 1. Overview It’s well known that auto-configuration is one of the key features in Spring Boot, but testing auto-configuration scenarios can be tricky. In the following sections, we’ll show how ApplicationContextRunner simplifies auto-configuration testing. 2. Test Auto-Configuration Scenarios ApplicationContextRunner is a utility class which runs… Continue Reading spring-boot-context-runner

Multi-Module Project With Spring Boot 1. Overview In this quick tutorial, we’ll show how to create a multi-module project with Spring Boot. First, we’ll build a library jar that isn’t an application itself, and then we’ll build an application that uses our library. For an introduction to Spring Boot, please refer to this… Continue Reading spring-boot-multiple-modules

Configuring a DataSource Programmatically in Spring Boot 1. Overview Spring Boot uses an opinionated algorithm to scan for and configure a DataSource. This allows us to easily get a fully-configured DataSource implementation by default. In addition, Spring Boot automatically configures a lightning-fast connection pool — either HikariCP, Apache Tomcat, or Commons DBCP, in… Continue Reading spring-boot-configure-data-source-programmatic

Container Configuration in Spring Boot 2 1. Overview  In this quick tutorial, we’ll have a look at how to replace the EmbeddedServletContainerCustomizer and ConfigurableEmbeddedServletContainer in Spring Boot 2. These classes were part of previous versions of Spring Boot, but have been removed starting with Spring Boot 2. Of course, the functionality… Continue Reading embeddedservletcontainercustomizer-configurableembeddedservletcontainer-spring-boot