package com.arms.config; import com.fasterxml.classmate.TypeResolver; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.ui.ModelMap; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.schema.AlternateTypeRules; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import javax.servlet.http.HttpServletRequest; import java.util.List; @Configuration public class Swagger2Config { @Autowired private TypeResolver typeResolver; @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .ignoredParameterTypes(ModelMap.class, HttpServletRequest.class) .select() .apis(RequestHandlerSelectors.basePackage("com")) .paths(PathSelectors.any()) .build() .apiInfo(apiInfo()) .enable(true) .alternateTypeRules( AlternateTypeRules.newRule( typeResolver.resolve(List.class), typeResolver.resolve(Enum.class) ) ); } private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("Java Service Tree Framework") .contact(new Contact("313 DEV GRP", "www.313.co.kr", "313cokr@gmail.com")) .version("1.0") .build(); } }