Files
openapi-generator/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache
2015-04-04 11:53:02 -07:00

39 lines
1.2 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.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.service.ApiInfo;
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")
public class SwaggerConfig {
@Bean
ApiInfo apiInfo() {
ApiInfo apiInfo = new ApiInfo(
"{{appName}}",
"{{appDescription}}",
"{{appVersion}}",
"{{infoUrl}}",
"{{infoEmail}}",
"{{licenseInfo}}",
"{{licenseUrl}}" );
return apiInfo;
}
@Bean
public Docket customImplementation(){
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo());
}
}