Book Image

Spring Boot Cookbook

By : Alex Antonov
Book Image

Spring Boot Cookbook

By: Alex Antonov

Overview of this book

Table of Contents (15 chapters)
Spring Boot Cookbook
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring route matching patterns


When we build web applications, it is not always the case that a default, out-of-the-box, mapping configuration is applicable. At times, we want to create our RESTful URLs that contain characters such as . (dot), which Spring treats as a delimiter defining format, for example the dot in path.xml, or we might not want to recognize a trailing slash, as in /home/, and so on. Conveniently, Spring provides us with a way to get this accomplished with ease.

In Chapter 2, Configuring Web Applications, we introduced a WebConfiguration class, which extends from WebMvcConfigurerAdapter. This extension allows us to override methods that are geared toward adding filters, formatters, and many more. It also has methods that can be overridden in order to configure the path match, among other things.

Let's imagine that the ISBN format does allow the use of dots to separate the book number from the revision with a pattern looking like [isbn-number].[revision].

How to do it...