Swagger实现Spring Web MVC不显示模型Schema

时间:2016-06-01 12:28:23

标签: spring spring-mvc swagger swagger-ui swagger-maven-plugin

我正在尝试使用Swagger实现Spring Web MVC,但问题是我无法获得模型Schema。 我正在附上带有问题的代码。 我正在关注以下链接:

http://raibledesigns.com/rd/entry/documenting_your_spring_api_with

问题是Swagger UI正在显示但是对于帖子请求它没有显示模型架构。

的pom.xml:

<dependency>
    <groupId>com.mangofactory</groupId>
    <artifactId>swagger-springmvc</artifactId>
    <version>0.5.2</version>
</dependency>

Spring.xml:

<mvc:annotation-driven />
    <context:component-scan base-package="com.ga" />
    <mvc:default-servlet-handler />
    <bean id="documentationConfig" class="com.mangofactory.swagger.configuration.DocumentationConfig" />

    <context:property-placeholder location="classpath:spring/application.properties"
        system-properties-mode="OVERRIDE" />

Customer Controller.java:

@Api(value="CustomerController",description="Customer Controller")
@RestController
public class CustomerController {

    @ApiOperation(value="save",notes="These Method is used to Save all Customer Details with its Deployment ")
    @RequestMapping(value = "/save", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Customer> saveCustomerDetails(@RequestBody Customer customer) throws CustomerException {

    }
}

应用程序属性:

documentation.services.version=1.0
documentation.services.basePath=http://localhost:9090/XYZ

1 个答案:

答案 0 :(得分:1)

我刚刚找到了上述问题的解决方案。我只是在内部配置swagger。

我按照这些链接来配置招摇。 https://github.com/ufasoli/spring-mvc-swagger-tutorial.

这些对我有用。