Swagger错误:解析JSON/YAML响应

问题描述:

我想为我的web项目(API)实施swagger。我正在使用maven spring MVC。我用下面的链接以供参考: https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-JAX-RS-Project-Setup-1.5.XSwagger错误:解析JSON/YAML响应

我添加以下在我的pom.xml文件的依赖性:

<dependency> 
     <groupId>io.swagger</groupId> 
     <artifactId>swagger-jersey-jaxrs</artifactId> 
     <version>1.5.0</version> 

     <exclusions> 
     <exclusion> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-core</artifactId> 
     </exclusion> 
     <exclusion> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-web</artifactId> 
     </exclusion> 
     <exclusion> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-beans</artifactId> 
     </exclusion> 
     <exclusion> 
      <artifactId>bean-validator</artifactId> 
      <groupId>org.glassfish.hk2.external</groupId> 
     </exclusion> 
     </exclusions> 

    </dependency> 

而且在应用程序配置:

<bean id="beanConfig" class="io.swagger.jaxrs.config.BeanConfig"> 
    <property name="title" value="Swagger Sample App" /> 
    <property name="version" value="1.0.0" /> 
    <property name="schemes" value="http" /> 
    <property name="host" value="localhost:8002" /> 
    <property name="basePath" value="/api" /> 
    <property name="resourcePackage" value="io.swagger.resources" /> 
    <property name="scan" value="true" /> 
    <property name="prettyPrint" value="true" /> 
</bean> 

<bean id="apiListingResource" class="io.swagger.jaxrs.listing.ApiListingResource" /> 
<bean id="swaggerSerializers" class="io.swagger.jaxrs.listing.SwaggerSerializers" 
    scope="singleton" /> 

如果我看到浏览器输出然后我得到以下屏幕: enter image description here

但如果我使用http://swagger.io/查看API的详细信息,然后我得到以下错误: enter image description here

我是新来的招摇吧,所以请帮我摆脱这个问题。

请查看http://springfox.github.io/springfox/以获得spring-mvc的支持。核心招牌工具支持球衣。