微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

带webflux的jhipster-Swagger无法正常运行

如何解决带webflux的jhipster-Swagger无法正常运行

我通过jhipster + webflux收到此错误,网关应用程序错误(JWT) 应用程序->注册表-网关(角度)-多种服务(webflux) http:// localhost:8080 / admin / docs

“类型”:“ https://www.jhipster.tech/problem/problem-with-message”, “ title”:“未找到”, “状态”:404, “ detail”:“ 404 NOT_FOUND”, “ path”:“ /swagger-ui.html”, “ message”:“ error.http.404”

.yo-rc.json

{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "org.abc.gateway","nativeLanguage": "en"
    },"jhipsterVersion": "6.10.3","applicationType": "gateway","baseName": "gateway","packageName": "org.abc.gateway","packageFolder": "org/abc/gateway","serverPort": "8080","authenticationType": "jwt","cacheProvider": "no","enableHibernateCache": false,"websocket": false,"databaseType": "mongodb","devDatabaseType": "mongodb","prodDatabaseType": "mongodb","searchEngine": false,"messagebroker": false,"servicediscoveryType": "eureka","buildTool": "maven","enableSwaggerCodegen": true,"jwtSecretKey": "XXXXXXXXXXXXXXXX","embeddableLaunchScript": false,"useSass": true,"clientPackageManager": "npm","clientFramework": "angularX","clientTheme": "none","clientThemeVariant": "","creationTimestamp": 1602227915588,"testFrameworks": ["gatling","cucumber","protractor"],"jhiPrefix": "jhi","entitySuffix": "","dtoSuffix": "DTO","otherModules": [],"enableTranslation": true,"nativeLanguage": "en","languages": ["en","hi"],"blueprints": [],"reactive": true
  }
}

昂首阔步的初始化错误

java.lang.NoSuchMethodError:springfox.documentation.spi.service.contexts.ParameterContext。(Lspringfox / documentation / service / ResolvedMethodParameter; Lspringfox / documentation / builders / ParameterBuilder; Lspringfox / documentation / spi / service / contexts / DocumentationContext; Lspringfox / documentation / spi / schema / GenericTypeNamingStrategy; Lspringfox / documentation / spi / service / contexts / OperationContext;)V

要检查spring-webflux项目的使用范围,我需要检查什么。

解决方法

我在 jhipster 项目中发现了一个问题:https://github.com/jhipster/generator-jhipster/issues/12072#issuecomment-683282300

修复它:

1- 更新依赖(删除旧的依赖)

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-boot-starter</artifactId>
        <version>${springfox.version}</version>
        <exclusions>
            <exclusion>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-bean-validators</artifactId>
            </exclusion>
            <exclusion>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-bean-validators</artifactId>
        <version>${springfox.version}</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>${springfox.version}</version>
    </dependency>

2 - 将整个项目中的路径“/v2/api-docs”更新为“/v3/api-docs”(前+后)

3 - 在 docs.component.html 中更改 URI

<iframe src="./swagger-ui/" width="100%" height="900" seamless
    target="_top" title="Swagger UI" class="border-0"></iframe>

4 - 我遇到了安全问题。 我允许 swagger 资源允许所有在 SecurityConfiguration 由于我在生产 spring 配置文件中禁用了 Swagger,这对我来说不是问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。