地址组件README

2019-04-11  本文已影响0人  泥煤的嘎嘎

Standard-Address

标准化地址组件

使用方法

<!--引入标准化address-->
<dependency>
    <groupId>com.standard</groupId>
    <artifactId>address</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>
@EnableAddressComponet
public class ManagementApplication {

    public static void main(String[] args) {
        SpringApplication.run(ManagementApplication.class, args);
    }

}
org.springframework.boot.autoconfigure.EnableAutoConfiguration=类全名
# mybatis
# 多环境不同配置(mapper文件放在不同工程下)
mybatis.mapper-locations=classpath:/mapper/address/*.xml,\
...
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * swagger config
 *
 * @author 伍磊
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                //扫描的是自定义Controller的包名
                //.apis(RequestHandlerSelectors.basePackage("com.standard"))
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .build();
    }
}
上一篇下一篇

猜你喜欢

热点阅读