com.paas.swagger.autoconfigure.PaaSSwaggerAutoConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of paas-swagger-starter Show documentation
Show all versions of paas-swagger-starter Show documentation
Custom Swagger Spring Boot Starter
The newest version!
package com.paas.swagger.autoconfigure;
import com.github.xiaoymin.swaggerbootstrapui.configuration.MarkdownFileConfiguration;
import com.github.xiaoymin.swaggerbootstrapui.configuration.SecurityConfiguration;
import com.github.xiaoymin.swaggerbootstrapui.configuration.SwaggerBootstrapUIConfiguration;
import com.paas.swagger.bean.props.OpenApiProps;
import com.paas.swagger.content.PaaSServletBootStrapper;
import com.paas.swagger.plugin.ApiBeanMapper;
import com.paas.swagger.plugin.ApiBeanPropertyPropertyBuilder;
import com.paas.swagger.plugin.ApiOperationBuilder;
import com.paas.swagger.plugin.ServiceModelToSwagger2MapperPlugin;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.SmartLifecycle;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import springfox.documentation.spi.schema.ModelPropertyBuilderPlugin;
import springfox.documentation.spi.service.OperationBuilderPlugin;
import springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration;
import springfox.documentation.swagger2.mappers.*;
/**
* @ClassName PaaSSwaggerAutoConfiguration
* @Date 2021/2/6 15:24
* @Auther wangyongyong
* @Version 1.0
* @Description paas swagger 自动配置
*/
@Configuration
@EnableConfigurationProperties(OpenApiProps.class)
@Import({Swagger2DocumentationConfiguration.class, SwaggerBootstrapUIConfiguration.class, SecurityConfiguration.class, MarkdownFileConfiguration.class})
public class PaaSSwaggerAutoConfiguration
{
@Bean
public SmartLifecycle swaggerSmartLifecycle()
{
return new PaaSServletBootStrapper();
}
@Bean
public ModelPropertyBuilderPlugin propertyBuilderPlugin()
{
return new ApiBeanPropertyPropertyBuilder();
}
@Bean
public OperationBuilderPlugin operationBuilderPlugin()
{
return new ApiOperationBuilder();
}
@Bean
public VendorExtensionsMapper vendorExtensionsMapper()
{
return new VendorExtensionsMapperImpl();
}
@Bean
public LicenseMapper licenseMapper()
{
return new LicenseMapperImpl();
}
@Bean
public ParameterMapper parameterMapper()
{
return new ParameterMapperImpl();
}
@Bean
public SecurityMapper securityMapper()
{
return new SecurityMapperImpl();
}
@Bean
@Primary
public ServiceModelToSwagger2Mapper serviceModelToSwagger2Mapper()
{
return new ServiceModelToSwagger2MapperPlugin();
}
@Bean
@Primary
public ApiBeanMapper apiBeanMapper()
{
return new ApiBeanMapper();
}
}