>  기사  >  Java  >  springboot 구성을 업데이트하는 방법 Swagger3

springboot 구성을 업데이트하는 방법 Swagger3

WBOY
WBOY앞으로
2023-05-27 20:30:031013검색

1. 종속성 소개, 버전 3.0.0

<dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>

2에만 도입되었습니다. 구성 클래스 SwaggerConfig

package org.fh.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * 说明:Swagger 接口API生成
 * 作者:FH Admin
 * from fhadmin.cn
 */
@Configuration
@EnableOpenApi
public class SwaggerConfig {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("org.fh.controller"))    // 为当前包路径
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("FH Admin Swagger3 RESTful API")     // 页面标题
                .version("3.0")                                // 版本号
                .description("fhadmin.org")                    // 描述
                .build();
    }

}

3.Swagger 차단 구성

package org.fh.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 说明:Swagger 拦截配置
 * 作者:FH Admin
 * from fhadmin.cn
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.
                addResourceHandler("/swagger-ui/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
                .resourceChain(false);
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/swagger-ui/")
                .setViewName("forward:/swagger-ui/index.html");
    }
}

4.访问 127.0.0.1:8081/swagger-ui/index.html

5.接口说明案例

处理类上加注解,比如
@Api("用户注册登录接口")

在方法上加注解,比如
@ApiOperation(value = "登录", notes="校验登录是否成功")
@ApiImplicitParam(name = "KEYDATA", value = "用户名密码混淆码组合", paramType = "query", required = true, dataType = "String")

워크플로 모듈------------ - -----------------www.fhadmin.cn

1. 모델 관리: 웹 온라인 프로세스 디자이너, XML 가져오기 및 내보내기, 복사 프로세스, 배포 프로세스

2. : 프로세스 리소스 파일 가져오기 및 내보내기, 흐름도 보기, 프로세스 인스턴스 기반 프로세스 모델 반영, 일시 중단 활성화

3. 실행 중인 프로세스: 프로세스 정보 보기, 현재 작업 노드, 현재 흐름 차트, 프로세스 무효화 및 일시 중지, 할당- dos People, 자유롭게 뛰어오르세요

4. 히스토리 프로세스: 프로세스 정보 보기, 프로세스 시간, 프로세스 상태, 작업 개시자 정보 보기

5. To-do 작업: 내 개인 작업 및 이 역할에 속한 작업 보기, 처리, 거부, 무효화 , 상담원 배정

6. 작업 완료: 처리한 작업과 처리 정보, 흐름도, 처리 상태 확인(보류 및 거부가 정상적으로 완료됨)

작업 처리 시 복사할 사용자를 선택할 수 있습니다. , 즉 복사된 사람은 현재 승인 의견과 비고를 알리기 위해 현장 메시지를 보냅니다.

참고: 현재 작업이 완료되면 다음 작업을 수행할 사람에게 새로운 작업 메시지 알림이 전송됩니다. 인스턴트 메시징을 통해 작업이 취소되고 완료되면

작업 개시자는 현장 메시지 알림을 받게 됩니다

위 내용은 springboot 구성을 업데이트하는 방법 Swagger3의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 yisu.com에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제