0

我正在尝试使用 Swagger 实现 Spring Web MVC,但问题是我无法获取模型模式。我附上了带有问题的代码,这个问题受到了打击。我正在关注以下链接:

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>

春天.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" />

客户控制器.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
4

1 回答 1

1

我刚刚找到了上述问题的解决方案。我只是在内部代码中配置了招摇。

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

这些真的对我有用。

于 2016-06-03T06:43:03.010 回答