forked from loafle/openapi-generator-original
44 lines
1.5 KiB
Plaintext
44 lines
1.5 KiB
Plaintext
package {{configPackage}};
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.PropertySource;
|
|
import org.springframework.context.annotation.Import;
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
import springfox.documentation.builders.ApiInfoBuilder;
|
|
import springfox.documentation.service.ApiInfo;
|
|
import springfox.documentation.service.Contact;
|
|
import springfox.documentation.spi.DocumentationType;
|
|
import springfox.documentation.spring.web.plugins.Docket;
|
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
|
|
|
|
@Configuration
|
|
@ComponentScan(basePackages = "{{apiPackage}}")
|
|
@EnableWebMvc
|
|
@EnableSwagger2 //Loads the spring beans required by the framework
|
|
@PropertySource("classpath:swagger.properties")
|
|
@Import(SwaggerUiConfiguration.class)
|
|
{{>generatedAnnotation}}
|
|
public class SwaggerConfig {
|
|
@Bean
|
|
ApiInfo apiInfo() {
|
|
return new ApiInfoBuilder()
|
|
.title("{{appName}}")
|
|
.description("{{{appDescription}}}")
|
|
.license("{{licenseInfo}}")
|
|
.licenseUrl("{{licenseUrl}}")
|
|
.termsOfServiceUrl("{{infoUrl}}")
|
|
.version("{{appVersion}}")
|
|
.contact(new Contact("","", "{{infoEmail}}"))
|
|
.build();
|
|
}
|
|
|
|
@Bean
|
|
public Docket customImplementation(){
|
|
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo());
|
|
}
|
|
|
|
}
|