Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knife4j:4.5.0版本在Spring Boot3.3.5中应用出现的问题 #877

Open
ttkOfCode opened this issue Dec 26, 2024 · 2 comments
Open

Knife4j:4.5.0版本在Spring Boot3.3.5中应用出现的问题 #877

ttkOfCode opened this issue Dec 26, 2024 · 2 comments

Comments

@ttkOfCode
Copy link

  • 问题描述
  1. No static resource v3/api-docs/swagger-config
    image
  2. 如果没有1中出现问题,就会呈现第二种问题:SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    image
  • 项目中相关配置
  1. 后端:

    依赖:

             <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>3.3.5</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
     <!-- knife4j-doc -->
            <dependency>
                <groupId>com.github.xiaoymin</groupId>
                <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
                <version>4.5.0</version>
            </dependency>
    
    

    application.yml(第一种情况)

       springdoc:
         swagger-ui:
           enabled: false
           path: /swagger-ui.html
           tags-sorter: alpha
           operations-sorter: alpha
         api-docs:
           enabled: true
           path: /v3/api-docs/
    

    application.yml(第二种情况)

        springdoc:
          swagger-ui:
            enabled: false
            path: /swagger-ui.html
            tags-sorter: alpha
            operations-sorter: alpha
          api-docs:
            enabled: true
            path: /dev-api/v3/api-docs/
    

对于第二种yml配置文件的补充说明:
显示效果
图1.Url中/dev-api前缀
image
图2.会在所有的controller接口中添加前缀/dev-api
image

@ttkOfCode
Copy link
Author

目前遇到的所有已经解决,如果有需要的可以在站联系我

@sztWDG
Copy link

sztWDG commented Jan 3, 2025

你好 我想请问一下是如何解决的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants