diff --git a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/BaseServiceConfiguration.java b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/BaseServiceConfiguration.java index 70870e83..6dcdd549 100644 --- a/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/BaseServiceConfiguration.java +++ b/sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/configuration/BaseServiceConfiguration.java @@ -17,6 +17,7 @@ import org.springframework.core.env.Environment; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; @@ -40,6 +41,15 @@ public class BaseServiceConfiguration extends WebMvcConfigurationSupport private ApiMappingHandlerMapping apiMappingHandlerMapping = new ApiMappingHandlerMapping(); + @Override + protected void addResourceHandlers(ResourceHandlerRegistry registry) { + super.addResourceHandlers(registry); + // 支持swagger-bootstrap-ui首页 + registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/"); + // 支持默认swagger + registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); + } @Override protected void addInterceptors(InterceptorRegistry registry) { diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/config/OpenServiceConfig.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/config/OpenServiceConfig.java index eb0c299f..b1f4c6a0 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/config/OpenServiceConfig.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/config/OpenServiceConfig.java @@ -4,7 +4,6 @@ import com.gitee.sop.servercommon.bean.ServiceConfig; import com.gitee.sop.servercommon.configuration.AlipayServiceConfiguration; import com.gitee.sop.servercommon.swagger.SwaggerSupport; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import springfox.documentation.swagger2.annotations.EnableSwagger2; /** @@ -14,21 +13,10 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration public class OpenServiceConfig extends AlipayServiceConfiguration { - static { ServiceConfig.getInstance().getI18nModules().add("i18n/isp/goods_error"); } - @Override - protected void addResourceHandlers(ResourceHandlerRegistry registry) { - super.addResourceHandlers(registry); - // 支持swagger-bootstrap-ui首页 - registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/"); - // 支持默认swagger - registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); - } - /** * 开启文档,本地微服务文档地址:http://localhost:2222/doc.html diff --git a/sop-gateway/src/main/java/com/gitee/sop/gateway/controller/ErrorLogController.java b/sop-gateway/src/main/java/com/gitee/sop/gateway/controller/ErrorLogController.java index 5d7670fc..93ab0dc6 100644 --- a/sop-gateway/src/main/java/com/gitee/sop/gateway/controller/ErrorLogController.java +++ b/sop-gateway/src/main/java/com/gitee/sop/gateway/controller/ErrorLogController.java @@ -62,7 +62,10 @@ public class ErrorLogController { private void check(HttpServletRequest request) { Map params = RequestUtil.convertRequestParamsToMap(request); ApiParam apiParam = ApiParam.build(params); - signer.checkSign(apiParam, secret); + boolean right = signer.checkSign(apiParam, secret); + if (!right) { + throw new RuntimeException("签名校验失败"); + } } } diff --git a/sop-test/pom.xml b/sop-test/pom.xml index 32057a51..ea8a9382 100644 --- a/sop-test/pom.xml +++ b/sop-test/pom.xml @@ -15,8 +15,7 @@ UTF-8 - 1.8 - 1.8 + 1.8 @@ -58,48 +57,39 @@ - - - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - - maven-surefire-plugin - 2.22.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - maven-site-plugin - 3.7.1 - - - maven-project-info-reports-plugin - 3.0.0 - - - + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12.4 + + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${java.version} + ${java.version} + UTF-8 + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + +