问题描述
我通过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,这对我来说不是问题。