Failed to run Spring Boot REST API with Swagger

date
Aug 1, 2022
slug
failed-to-run-spring-boot-rest-api-with-swagger
status
Published
tags
Bugfix
API
REST
Spring Boot
Swagger
summary
type
Post

Problem

I was trying to run my Dog REST API with Swagger built on Spring Boot 2.7.1, but I received the error below:

What’s wrong

This error was occurring because SpringFox is not compatible with PathPattern-based matching in Spring MVC, which is used in the version 2.6.3 and that replaced the previous Ant-based matching in the Spring Boot default settings.

Solution

To resolve this error, in application.properties We can include the property:

References


© Foy Wan 2022 - 2025