package com.yuzhouwan.site.service.doc;

import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
import com.mangofactory.swagger.models.dto.ApiInfo;
import com.mangofactory.swagger.plugin.EnableSwagger;
import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

/**
 * Copyright @ 2020 yuzhouwan.com
 * All right reserved.
 * Function：Custom Java Plugin Config
 *
 * @author Benedict Jin
 * @since 2016/8/7
 */
@Configuration
@EnableWebMvc
@EnableSwagger
@ComponentScan("com.yuzhouwan.site")
public class CustomJavaPluginConfig {

    private SpringSwaggerConfig springSwaggerConfig;

    @Autowired
    public void setSpringSwaggerConfig(SpringSwaggerConfig springSwaggerConfig) {
        this.springSwaggerConfig = springSwaggerConfig;
    }

    @Bean //Don't forget the @Bean annotation
    public SwaggerSpringMvcPlugin customImplementation() {
        return new SwaggerSpringMvcPlugin(this.springSwaggerConfig)
                .apiInfo(apiInfo())
                .includePatterns(".*pet.*");
    }

    private ApiInfo apiInfo() {
        return new ApiInfo(
                "My Apps API Title",
                "My Apps API Description",
                "My Apps API terms of service",
                "My Apps API Contact Email",
                "My Apps API Licence Type",
                "My Apps API License URL"
        );
    }
}

@@ -105,60 +105,8 @@
 ig;%0A
-import com.mangofactory.swagger.models.dto.ApiInfo;%0A
 impo
@@ -1204,406 +1204,33 @@
    .
-apiInfo(apiInfo())%0A                .includePatterns(%22.*pet.*%22);%0A    %7D%0A%0A    private ApiInfo apiInfo() %7B%0A        return new ApiInfo(%0A                %22My Apps API Title%22,%0A                %22My Apps API Description%22,%0A                %22My Apps API terms of service%22,%0A                %22My Apps API Contact Email%22,%0A                %22My Apps API Licence Type%22,%0A                %22My Apps API License URL%22%0A        
+includePatterns(%22.*pet.*%22
 );%0A 

Remove ApiInfo