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 RESTful URLs that contain characters such as dot (.
), which Spring treats as a delimiter-defining format, like path.xml
; or we might not want to recognize a trailing slash, and so on. Conveniently, Spring provides us with a way to accomplish this with ease.
In Chapter 21, 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...
We will configure our application to not...