Skip to content

基于SpringMVC, Springfox的一个api文档服务器端例子。

Notifications You must be signed in to change notification settings

shildondu/api-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-server build

This is a demo for using springfox to generate api docs in springmvc project.

Usage

1. Clone or Download the project.

2. Create a domain model in package com.shildon.api.model. Here is a example:

@ApiModel("result")
public class AjaxResult {

	@ApiModelProperty("status code")
	private String code;
	@ApiModelProperty("model")
	private Object data;

	// getter and setter

}

3. Create a spring mvc controller in package com.shildon.api.controller.

@Controller
@RequestMapping("/demo")
@Api(tags = "A Demo")
public class DemoController {

	@RequestMapping(value = "/test.do", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation(value = "just test", notes = "again")
	public AjaxResult test(@ApiParam("identity") String id) {
		return new AjaxResult();
	}

}

4. run mvn tomcat:run.

5. open browser and visit http://localhost:8080/api-server.

ScreenShot

api-server api-server

About

基于SpringMVC, Springfox的一个api文档服务器端例子。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages