<!--restfull APi swagger2-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<!-- swagger2 配置类--> <bean id="config" class="com.rambo.spm.core.config.SwaggerConfig"/> <!-- swagger2 静态资源交由 spring 管理映射(springfox-swagger-ui.jar 为静态资源包)--> <mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/> <mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
ApiInfoBuilder apiInfoBuilder = new ApiInfoBuilder();
apiInfoBuilder.title("SPM Doc");
apiInfoBuilder.description("SPM Api文档");
apiInfoBuilder.contact(new Contact("orson", "https://www.cnblogs.com/", ""));
apiInfoBuilder.version("2.0");
return apiInfoBuilder.build();
}
}
@Api(description = "用户管理")
@ApiOperation(value = "获取所有用户列表")
@ApiParam(value = "用户ID") String userId
@RestController
@Api(description = "用户管理")
public class UserRestController extends BaseController {
@Autowired
private SysUserService sysUserService;
@GetMapping("r/user/get")
@ApiOperation(value = "获取特定用户详情")
public Object getUser(ModelMap modelMap, @ApiParam(value = "用户ID") String userId) {
}
@PostMapping("r/user/add")
@ApiOperation(value = "添加用户")
public Object addUser(ModelMap modelMap, @ModelAttribute @Valid SysUser user, BindingResult result) {
}
}
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.ignoredParameterTypes(ModelMap.class, HttpServletRequest.class,HttpServletResponse.class, BindingResult.class)
.select()
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.paths(PathSelectors.any())
.build();
}
@ApiModelProperty(hidden = true)
private String uuid;
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("密码")
private String passwd;
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有