An article takes you to solve Unable to infer base url. This is common when using dynamic servlet registra

Insert picture description here
I am using the 2.10.2 version of swagger here. This version will be removed because it supports WebFlux, and it @EnableSwagger2will become @EnableSwagger2WebMvcas well as@EnableSwagger2WebFlux

 		<dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.10.2</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.10.2</version>
        </dependency>

Learning SpringBoot to integrate Swagger2, I suddenly encountered this problem after configuration

I searched various answers on the Internet and tried:
(1) Startup class plus scan config path
(2) Startup class plus annotation@EnableSwagger2WebFlux

It doesn't work. . . . .

Finally changed the version, replaced by swagger2 version 2.9.2

		 <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
        </dependency>

Then it worked, which is strange. . . . .

Insert picture description here

If you know why, welcome to leave a message to discuss

Guess you like

Origin blog.csdn.net/nanhuaibeian/article/details/109245228