docs: 演示修改

pull/3/head
shuliYao 1 year ago committed by sunchenliang
parent 646ace6e5d
commit 7e9c134a91

@ -35,13 +35,14 @@ import java.util.List;
import java.util.stream.Collectors;
/**
*
* @Author scott
*/
@Configuration
@EnableSwagger2 //开启 Swagger2
@Import(BeanValidatorPluginsConfiguration.class)
public class SwaggerFlowableConfig implements WebMvcConfigurer {
/**
*
*/
@ -59,7 +60,7 @@ public class SwaggerFlowableConfig implements WebMvcConfigurer {
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
/**
* swagger2swagger2
*
@ -82,7 +83,7 @@ public class SwaggerFlowableConfig implements WebMvcConfigurer {
.securityContexts(securityContexts())
.globalOperationParameters(setHeaderToken());
}
/***
* oauth2
* swagger
@ -104,7 +105,7 @@ public class SwaggerFlowableConfig implements WebMvcConfigurer {
pars.add(tokenPar.build());
return pars;
}
/**
* api,
*
@ -125,7 +126,7 @@ public class SwaggerFlowableConfig implements WebMvcConfigurer {
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
.build();
}
/**
* securityContexts
*/
@ -137,7 +138,7 @@ public class SwaggerFlowableConfig implements WebMvcConfigurer {
.build())
);
}
private List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
@ -145,7 +146,7 @@ public class SwaggerFlowableConfig implements WebMvcConfigurer {
return new ArrayList(
Collections.singleton(new SecurityReference(SystemConstants.X_ACCESS_TOKEN, authorizationScopes)));
}
/**
* springboot2.6 springfox
* @return
@ -153,7 +154,7 @@ public class SwaggerFlowableConfig implements WebMvcConfigurer {
@Bean
public static BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
return new BeanPostProcessor() {
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) {
@ -161,7 +162,7 @@ public class SwaggerFlowableConfig implements WebMvcConfigurer {
}
return bean;
}
private <T extends RequestMappingInfoHandlerMapping> void customizeSpringfoxHandlerMappings(List<T> mappings) {
List<T> copy = mappings.stream()
.filter(mapping -> mapping.getPatternParser() == null)
@ -169,7 +170,7 @@ public class SwaggerFlowableConfig implements WebMvcConfigurer {
mappings.clear();
mappings.addAll(copy);
}
@SuppressWarnings("unchecked")
private List<RequestMappingInfoHandlerMapping> getHandlerMappings(Object bean) {
try {

Loading…
Cancel
Save