我使用的是Spring启动2.1.6。发布
以及springfox-swagger2
version3.0.0-SNAPSHOT
。但无法启动swagger-ui(即http://localhost:808/swagger-ui.html)或api-docs(即http://localhost:8080/v2/api-docs)网址。
相同的配置适用于springfox-Swagger 2.9.2版
。唯一的区别是在3.0.0-SNAPSHOT
中添加了@EnableSwagger2WebMvc
。
错误详细信息
这是我的pom。xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath />
<!-- lookup parent from service -->
</parent>
<groupId>com.mytrainst.train</groupId>
<artifactId>mytransit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mytransit</name>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>spring-mock-mvc</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jcenter-snapshots</id>
<name>jcenter</name>
<url>http://oss.jfrog.org/artifactory/oss-snapshot-local/</url>
</repository>
</repositories>
</project>
这是昂首阔步的配置
package com.mytrainst.train.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.pathMapping("/");
}
}
控制器接口
package com.mytrainst.train.controller;
import com.mytrainst.train.domain.Train;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/trains", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public interface ITrainController {
@GetMapping("/name/{name}")
Train findByName(@PathVariable final String name);
}
控制器实现
package com.mytrainst.train.controller;
import com.mytrainst.train.domain.Train;
import com.mytrainst.train.service.ITrainService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
@Component
@AllArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
public class TrainController implements ITrainController {
private ITrainService trainService;
@Override
public Train findByName(@PathVariable final String name) {
log.info(":: Request received: {} ", name);
return trainService.findByName(name);
}
}
Spring启动应用程序
package com.mytrainst.train;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
并使用TRACE
记录springwebframe日志
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.6.RELEASE)
11:31:36.785 [main] DEBUG o.s.w.c.ContextLoader - Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
11:31:36.785 [main] INFO o.s.w.c.ContextLoader - Root WebApplicationContext: initialization completed in 1235 ms
11:31:38.159 [main] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped [/**/favicon.ico] onto ResourceHttpRequestHandler [class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], ServletContext resource [/], class path resource []]
11:31:38.159 [main] DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - Patterns [/**/favicon.ico] in 'faviconHandlerMapping'
11:31:38.269 [main] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerAdapter - ControllerAdvice beans: 0 @ModelAttribute, 0 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
11:31:38.300 [main] TRACE o.s.w.s.m.m.a.RequestMappingHandlerMapping -
c.m.t.c.TrainController:
{GET /trains/name/{name}, produces [application/json;charset=UTF-8]}: findByName(String)
11:31:38.315 [main] TRACE o.s.w.s.m.m.a.RequestMappingHandlerMapping -
o.s.b.a.w.s.e.BasicErrorController:
{ /error}: error(HttpServletRequest)
{ /error, produces [text/html]}: errorHtml(HttpServletRequest,HttpServletResponse)
11:31:38.315 [main] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - 3 mappings in 'requestMappingHandlerMapping'
11:31:38.315 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Detected 0 mappings in 'beanNameHandlerMapping'
11:31:38.315 [main] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped [/webjars/**] onto ResourceHttpRequestHandler ["classpath:/META-INF/resources/webjars/"]
11:31:38.315 [main] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped [/**] onto ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
11:31:38.315 [main] DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
11:31:38.331 [main] DEBUG o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver - ControllerAdvice beans: 0 @ExceptionHandler, 1 ResponseBodyAdvice
11:31:47.329 [http-nio-8080-exec-1] INFO o.s.w.s.DispatcherServlet - Initializing Servlet 'dispatcherServlet'
11:31:47.329 [http-nio-8080-exec-1] TRACE o.s.w.s.DispatcherServlet - Detected org.springframework.web.multipart.support.StandardServletMultipartResolver@4837f97e
11:31:47.329 [http-nio-8080-exec-1] TRACE o.s.w.s.DispatcherServlet - No LocaleResolver 'localeResolver': using default [AcceptHeaderLocaleResolver]
11:31:47.345 [http-nio-8080-exec-1] TRACE o.s.w.s.DispatcherServlet - No ThemeResolver 'themeResolver': using default [FixedThemeResolver]
11:31:47.345 [http-nio-8080-exec-1] TRACE o.s.w.s.DispatcherServlet - No RequestToViewNameTranslator 'viewNameTranslator': using default [DefaultRequestToViewNameTranslator]
11:31:47.345 [http-nio-8080-exec-1] TRACE o.s.w.s.DispatcherServlet - No FlashMapManager 'flashMapManager': using default [SessionFlashMapManager]
11:31:47.345 [http-nio-8080-exec-1] DEBUG o.s.w.s.DispatcherServlet - enableLoggingRequestDetails='false': request parameters and headers will be masked to prevent unsafe logging of potentially sensitive data
11:31:47.345 [http-nio-8080-exec-1] INFO o.s.w.s.DispatcherServlet - Completed initialization in 16 ms
11:31:47.345 [http-nio-8080-exec-1] TRACE o.s.w.s.DispatcherServlet - GET "/swagger-ui.html", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.360 [http-nio-8080-exec-1] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]] and 4 interceptors
11:31:47.376 [http-nio-8080-exec-1] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.376 [http-nio-8080-exec-1] DEBUG o.s.w.s.DispatcherServlet - Completed 200 OK, headers={masked}
11:31:47.454 [http-nio-8080-exec-2] TRACE o.s.w.s.DispatcherServlet - GET "/webjars/springfox-swagger-ui/springfox.css?v=3.0.0-SNAPSHOT", parameters={masked}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.454 [http-nio-8080-exec-2] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Matching patterns [/webjars/**, /**]
11:31:47.454 [http-nio-8080-exec-3] TRACE o.s.w.s.DispatcherServlet - GET "/webjars/springfox-swagger-ui/swagger-ui.css?v=3.0.0-SNAPSHOT", parameters={masked}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.454 [http-nio-8080-exec-2] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/webjars/"]] and 4 interceptors
11:31:47.454 [http-nio-8080-exec-5] TRACE o.s.w.s.DispatcherServlet - GET "/webjars/springfox-swagger-ui/swagger-ui-standalone-preset.js?v=3.0.0-SNAPSHOT", parameters={masked}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.454 [http-nio-8080-exec-4] TRACE o.s.w.s.DispatcherServlet - GET "/webjars/springfox-swagger-ui/swagger-ui-bundle.js?v=3.0.0-SNAPSHOT", parameters={masked}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.454 [http-nio-8080-exec-6] TRACE o.s.w.s.DispatcherServlet - GET "/webjars/springfox-swagger-ui/springfox.js?v=3.0.0-SNAPSHOT", parameters={masked}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.454 [http-nio-8080-exec-3] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Matching patterns [/webjars/**, /**]
11:31:47.454 [http-nio-8080-exec-3] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/webjars/"]] and 4 interceptors
11:31:47.454 [http-nio-8080-exec-4] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Matching patterns [/webjars/**, /**]
11:31:47.454 [http-nio-8080-exec-6] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Matching patterns [/webjars/**, /**]
11:31:47.454 [http-nio-8080-exec-5] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Matching patterns [/webjars/**, /**]
11:31:47.454 [http-nio-8080-exec-4] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/webjars/"]] and 4 interceptors
11:31:47.454 [http-nio-8080-exec-6] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/webjars/"]] and 4 interceptors
11:31:47.454 [http-nio-8080-exec-5] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/webjars/"]] and 4 interceptors
11:31:47.469 [http-nio-8080-exec-2] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.469 [http-nio-8080-exec-2] DEBUG o.s.w.s.DispatcherServlet - Completed 200 OK, headers={masked}
11:31:47.469 [http-nio-8080-exec-6] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.469 [http-nio-8080-exec-6] DEBUG o.s.w.s.DispatcherServlet - Completed 200 OK, headers={masked}
11:31:47.469 [http-nio-8080-exec-3] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.469 [http-nio-8080-exec-3] DEBUG o.s.w.s.DispatcherServlet - Completed 200 OK, headers={masked}
11:31:47.469 [http-nio-8080-exec-5] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.485 [http-nio-8080-exec-5] DEBUG o.s.w.s.DispatcherServlet - Completed 200 OK, headers={masked}
11:31:47.501 [http-nio-8080-exec-4] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.501 [http-nio-8080-exec-4] DEBUG o.s.w.s.DispatcherServlet - Completed 200 OK, headers={masked}
11:31:47.719 [http-nio-8080-exec-7] TRACE o.s.w.s.DispatcherServlet - GET "/swagger-resources/configuration/ui", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.719 [http-nio-8080-exec-7] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]] and 4 interceptors
11:31:47.719 [http-nio-8080-exec-7] DEBUG o.s.w.s.r.ResourceHttpRequestHandler - Resource not found
11:31:47.719 [http-nio-8080-exec-7] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.719 [http-nio-8080-exec-7] DEBUG o.s.w.s.DispatcherServlet - Completed 404 NOT_FOUND, headers={}
11:31:47.735 [http-nio-8080-exec-7] TRACE o.s.w.s.DispatcherServlet - "ERROR" dispatch for GET "/error", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.735 [http-nio-8080-exec-7] TRACE o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped to public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
11:31:47.735 [http-nio-8080-exec-7] TRACE o.s.w.s.m.m.a.ServletInvocableHandlerMethod - Arguments: [org.apache.catalina.core.ApplicationHttpRequest@6c5d58b]
11:31:47.751 [http-nio-8080-exec-7] DEBUG o.s.w.s.m.m.a.HttpEntityMethodProcessor - Using 'application/json', given [application/json] and supported [application/json, application/*+json, application/json, application/*+json]
11:31:47.751 [http-nio-8080-exec-7] TRACE o.s.w.s.m.m.a.HttpEntityMethodProcessor - Writing [{timestamp=Thu Jul 04 11:31:47 EDT 2019, status=404, error=Not Found, message=No message available, path=/swagger-resources/configuration/ui}]
11:31:47.782 [http-nio-8080-exec-7] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.782 [http-nio-8080-exec-7] DEBUG o.s.w.s.DispatcherServlet - Exiting from "ERROR" dispatch, status 404, headers={masked}
11:31:47.782 [http-nio-8080-exec-8] TRACE o.s.w.s.DispatcherServlet - GET "/webjars/springfox-swagger-ui/favicon-32x32.png?v=3.0.0-SNAPSHOT", parameters={masked}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.782 [http-nio-8080-exec-8] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Matching patterns [/webjars/**, /**]
11:31:47.782 [http-nio-8080-exec-8] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/webjars/"]] and 4 interceptors
11:31:47.782 [http-nio-8080-exec-8] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.782 [http-nio-8080-exec-8] DEBUG o.s.w.s.DispatcherServlet - Completed 200 OK, headers={masked}
11:31:47.798 [http-nio-8080-exec-9] TRACE o.s.w.s.DispatcherServlet - GET "/swagger-resources/configuration/security", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.798 [http-nio-8080-exec-9] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]] and 4 interceptors
11:31:47.798 [http-nio-8080-exec-9] DEBUG o.s.w.s.r.ResourceHttpRequestHandler - Resource not found
11:31:47.798 [http-nio-8080-exec-9] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.798 [http-nio-8080-exec-9] DEBUG o.s.w.s.DispatcherServlet - Completed 404 NOT_FOUND, headers={}
11:31:47.798 [http-nio-8080-exec-9] TRACE o.s.w.s.DispatcherServlet - "ERROR" dispatch for GET "/error", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.798 [http-nio-8080-exec-9] TRACE o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped to public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
11:31:47.798 [http-nio-8080-exec-9] TRACE o.s.w.s.m.m.a.ServletInvocableHandlerMethod - Arguments: [org.apache.catalina.core.ApplicationHttpRequest@21a5053e]
11:31:47.798 [http-nio-8080-exec-9] DEBUG o.s.w.s.m.m.a.HttpEntityMethodProcessor - Using 'application/json', given [application/json] and supported [application/json, application/*+json, application/json, application/*+json]
11:31:47.798 [http-nio-8080-exec-9] TRACE o.s.w.s.m.m.a.HttpEntityMethodProcessor - Writing [{timestamp=Thu Jul 04 11:31:47 EDT 2019, status=404, error=Not Found, message=No message available, path=/swagger-resources/configuration/security}]
11:31:47.798 [http-nio-8080-exec-9] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.798 [http-nio-8080-exec-9] DEBUG o.s.w.s.DispatcherServlet - Exiting from "ERROR" dispatch, status 404, headers={masked}
11:31:47.813 [http-nio-8080-exec-10] TRACE o.s.w.s.DispatcherServlet - GET "/swagger-resources", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.813 [http-nio-8080-exec-10] TRACE o.s.w.s.h.SimpleUrlHandlerMapping - Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]] and 4 interceptors
11:31:47.813 [http-nio-8080-exec-10] DEBUG o.s.w.s.r.ResourceHttpRequestHandler - Resource not found
11:31:47.813 [http-nio-8080-exec-10] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.813 [http-nio-8080-exec-10] DEBUG o.s.w.s.DispatcherServlet - Completed 404 NOT_FOUND, headers={}
11:31:47.813 [http-nio-8080-exec-10] TRACE o.s.w.s.DispatcherServlet - "ERROR" dispatch for GET "/error", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet'
11:31:47.813 [http-nio-8080-exec-10] TRACE o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped to public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
11:31:47.813 [http-nio-8080-exec-10] TRACE o.s.w.s.m.m.a.ServletInvocableHandlerMethod - Arguments: [org.apache.catalina.core.ApplicationHttpRequest@2e4ca218]
11:31:47.813 [http-nio-8080-exec-10] DEBUG o.s.w.s.m.m.a.HttpEntityMethodProcessor - Using 'application/json', given [application/json] and supported [application/json, application/*+json, application/json, application/*+json]
11:31:47.813 [http-nio-8080-exec-10] TRACE o.s.w.s.m.m.a.HttpEntityMethodProcessor - Writing [{timestamp=Thu Jul 04 11:31:47 EDT 2019, status=404, error=Not Found, message=No message available, path=/swagger-resources}]
11:31:47.813 [http-nio-8080-exec-10] TRACE o.s.w.s.DispatcherServlet - No view rendering, null ModelAndView returned.
11:31:47.813 [http-nio-8080-exec-10] DEBUG o.s.w.s.DispatcherServlet - Exiting from "ERROR" dispatch, status 404, headers={masked}
我不确定在3.0.0-SNAPSHOT版本中使用springfox-swagger2时缺少了什么。我根本没有启用任何安全性。我想用普通的香草春网和招摇。非常感谢在解决这个问题上的任何建议。
据我所知,Springboot2不适用于swagger 2.9。请参考这篇文章
将缺少的依赖项添加到pom后,问题得到解决。xml
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-webmvc</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
这是一个什么样的问题?项目结构:SwaggerConfig在中的身份验证配置在中 依赖关系 至于Spring靴 我的一个控制器的示例我的所有控制器都映射为 问题 工作很好,我会返回所有endpoint及其详细信息弹出显示“无法推断基本URL......” 我的日志看起来像: 不幸的是,我发现在日志的and处的路径映射有些奇怪:GET“/null/swagger-resources/configur
这是什么问题?项目结构:swaggenConfig位于automate.api.web.Auth.keycloak.falconkeycloakconfigurerAdapter中 依赖关系 至于Spring靴 我的一个控制器的示例我的所有控制器都像一样映射 发行 工作得很好,我得到了所有endpoint及其详细信息弹出一个显示“无法推断基本URL......” 求求你,帮帮我!:) 我仔细研究了
为什么springfox-swagger2 UI告诉我据我所知,我使用的是典型的Swagger spring-boot配置。 正如您在屏幕截图中看到的,支持UI的swagger-fox url是example.com/api。注意:当我导航到:https://localhost:9600/api/v2/api-docs/时,会得到一个标准的Spring。我怀疑这是问题的根源?我没有看到Spring
我刚刚将我的Spring Boot应用程序(版本2.3.1.RELEASE)中的Springfox依赖项从2.9.2更新到2.10.4。 由于< code > spring fox . documentation . * 包中的类发生了变化,我不得不将配置类中的注释从 到 还谓词进口从谷歌Guav 当我现在打开 http://localhost:8080/swagger-ui.html 时,我收到
为什么springfox-Swagger2UI告诉我
我们在API网关后面有Spring Boot服务。使用SpringFox-2.1.2的早期版本,我们在加载页面时没有任何问题。这适用于Spring Boot1.4.3.Release。从那时起,我们已经升级到引导1.5.7,并将Springfox升级到2.8.0。 现在,如果我们加载页面,我们会得到一个带有以下长消息的警告框。 null 你知道为什么会这样吗?有人面临类似的问题吗?解决办法的建议?