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>

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" />

顧客 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
4

1 に答える 1

1

上記の問題の解決策を見つけました。コードでswaggerを内部的に構成するだけです。

これらのリンクに従って、swagger を構成しました。 https://github.com/ufasoli/spring-mvc-swagger-tutorial。

これらは私にとって本当にうまくいきます。

于 2016-06-03T06:43:03.010 に答える