Java rest service.model クラスで swagger を使用してい@apimodel
ます@apimodelproperty
。ハイスワッガー スプリング MVC バージョンを使用すると、データが読み込まれます。しかし、このバージョンには Documention 構成が含まれていないなどのエラーが発生します。この問題を解決する方法.swagger spring MVC?
0.5.3 version pom.xml
Spring.xml
この Bean は、Spring XML ファイル内に含まれています。
<bean id="documentationConfig"
class="com.mangofactory.swagger.configuration.DocumentationConfig" />
コントローラ HomeController.java
package com.example.anand.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
@Api(value = "main controller", description = "Endpoint for TEST Managemenent")
@Controller
@RequestMapping("/newfinalmvc")
public class HomeController {
@RequestMapping(value = "/addnew", method = RequestMethod.POST)
@ApiOperation(value = "Addnew ", notes = "Add new Controller")
public @ResponseBody Object addNew(@RequestBody hello hel) {
String getName = hel.getName();
System.out.println(getName);
hello h1 = new hello();
h1.setName(getName);
return h1;
}
}
@Apimodel および @Apimodelproperty アノテーションをモデル クラス レベルで表示しないセッターおよびゲッターを支援するモデル クラス
public class hello {
String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
なぜ私はこの問題に直面しているのですか?