From dec689d03443d5a9a345b6439cb34adb078d9dca Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Sat, 11 May 2019 09:14:48 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E9=9B=86=E6=88=90=20mall=20-=20spring=20bo?= =?UTF-8?q?ot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- order/order-application/pom.xml | 5 ++ .../application/config/MVCConfiguration.java | 52 ------------------- .../config/SwaggerConfiguration.java | 36 ------------- .../src/main/resources/application.yaml | 6 +++ 4 files changed, 11 insertions(+), 88 deletions(-) delete mode 100644 order/order-application/src/main/java/cn/iocoder/mall/order/application/config/MVCConfiguration.java delete mode 100644 order/order-application/src/main/java/cn/iocoder/mall/order/application/config/SwaggerConfiguration.java diff --git a/order/order-application/pom.xml b/order/order-application/pom.xml index ee1e595c4..5ada24e2a 100644 --- a/order/order-application/pom.xml +++ b/order/order-application/pom.xml @@ -38,6 +38,11 @@ user-sdk 1.0-SNAPSHOT + + cn.iocoder.mall + mall-spring-boot + 1.0-SNAPSHOT + diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/config/MVCConfiguration.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/config/MVCConfiguration.java deleted file mode 100644 index 42f0c2560..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/config/MVCConfiguration.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.iocoder.mall.order.application.config; - -import cn.iocoder.common.framework.exception.GlobalExceptionHandler; -import cn.iocoder.common.framework.servlet.CorsFilter; -import cn.iocoder.mall.admin.sdk.interceptor.AdminSecurityInterceptor; -import cn.iocoder.mall.user.sdk.interceptor.UserAccessLogInterceptor; -import cn.iocoder.mall.user.sdk.interceptor.UserSecurityInterceptor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.servlet.FilterRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.web.servlet.config.annotation.*; - -@EnableWebMvc -@Configuration -@Import(value = {GlobalExceptionHandler.class, // 统一全局返回 - UserSecurityInterceptor.class, AdminSecurityInterceptor.class, - UserAccessLogInterceptor.class}) // 安全拦截器,实现认证和授权功能。 -public class MVCConfiguration implements WebMvcConfigurer { - -// @Autowired -// private SecurityInterceptor securityInterceptor; - -// @Reference -// private OAuth2Service oauth2Service; - - @Autowired - private UserSecurityInterceptor userSecurityInterceptor; - @Autowired - private UserAccessLogInterceptor userAccessLogInterceptor; - @Autowired - private AdminSecurityInterceptor adminSecurityInterceptor; - - @Override - public void addInterceptors(InterceptorRegistry registry) { - // 用户 - registry.addInterceptor(userAccessLogInterceptor).addPathPatterns("/users/**"); - registry.addInterceptor(userSecurityInterceptor).addPathPatterns("/users/**"); // 只拦截我们定义的接口 - // 管理员 - registry.addInterceptor(adminSecurityInterceptor).addPathPatterns("/admins/**"); // 只拦截我们定义的接口 - } - - @Bean - public FilterRegistrationBean corsFilter() { - FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); - registrationBean.setFilter(new CorsFilter()); - registrationBean.addUrlPatterns("/*"); - return registrationBean; - } - -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/config/SwaggerConfiguration.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/config/SwaggerConfiguration.java deleted file mode 100644 index a935ffade..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/config/SwaggerConfiguration.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.mall.order.application.config; - -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; - -@Configuration -@EnableSwagger2 -public class SwaggerConfiguration { - - @Bean - public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.basePackage("cn.iocoder.mall.order.controller")) - .paths(PathSelectors.any()) - .build(); - } - - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("订单子系统") - .description("订单子系统") - .termsOfServiceUrl("http://www.iocoder.cn") - .version("1.0.0") - .build(); - } - -} \ No newline at end of file diff --git a/order/order-application/src/main/resources/application.yaml b/order/order-application/src/main/resources/application.yaml index 1180b36f3..e9f9b609f 100644 --- a/order/order-application/src/main/resources/application.yaml +++ b/order/order-application/src/main/resources/application.yaml @@ -7,3 +7,9 @@ server: port: 18088 servlet: context-path: /order-api/ + +swagger: + title: 订单子系统 + description: 订单子系统 + version: 1.0.0 + base-package: cn.iocoder.mall.pay.application.controller