diff --git a/usergw-service/src/main/java/cn/ecpark/service/usergw/config/ConfigProperties.java b/usergw-service/src/main/java/cn/ecpark/service/usergw/config/ConfigProperties.java index 9b462b1..e997ed8 100644 --- a/usergw-service/src/main/java/cn/ecpark/service/usergw/config/ConfigProperties.java +++ b/usergw-service/src/main/java/cn/ecpark/service/usergw/config/ConfigProperties.java @@ -33,6 +33,7 @@ import org.springframework.cloud.gateway.route.RouteDefinition; import org.springframework.context.ApplicationContext; import org.springframework.util.ReflectionUtils; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.reactive.result.condition.PatternsRequestCondition; import org.springframework.web.reactive.result.condition.RequestMethodsRequestCondition; import org.springframework.web.reactive.result.method.RequestMappingInfo; @@ -40,6 +41,7 @@ import org.springframework.web.reactive.result.method.annotation.RequestMappingH import org.springframework.web.util.pattern.PathPattern; import org.springframework.web.util.pattern.PathPatternParser; +import cn.ecpark.service.usergw.impl.http.Http2Dubbo; import cn.ecpark.service.usergw.utils.Convert; import lombok.extern.slf4j.Slf4j; @@ -132,16 +134,12 @@ public class ConfigProperties { } public static void createHttp2Dubbo(Map configDubbo) { - // requestMapping.registerMapping(mapping, handler, method); - - Method targetMethod = ReflectionUtils.findMethod(ApiController.class, getHandlerMethodName("")); // 找到处理该路由的方法 - PathPatternParser pathPatternParser = new PathPatternParser(); - PathPattern p = pathPatternParser.parse("/test/xixi"); - PatternsRequestCondition patternsRequestCondition = new PatternsRequestCondition(p); - RequestMethodsRequestCondition requestMethodsRequestCondition = new RequestMethodsRequestCondition(getRequestMethod(requestMethod)); - - RequestMappingInfo mapping_info = new RequestMappingInfo(patternsRequestCondition, requestMethodsRequestCondition, null, null, null, null, null); + + Method targetMethod = ReflectionUtils.findMethod(Http2Dubbo.class, "12"); // 找到处理该路由的方法 + requestMapping.registerMapping(RequestMappingInfo.paths("/test/xixi").methods(RequestMethod.POST).build(), + applicationContext, + targetMethod); // 引用远程服务 try { diff --git a/usergw-service/src/main/java/cn/ecpark/service/usergw/impl/http/Http2Dubbo.java b/usergw-service/src/main/java/cn/ecpark/service/usergw/impl/http/Http2Dubbo.java new file mode 100644 index 0000000..af78223 --- /dev/null +++ b/usergw-service/src/main/java/cn/ecpark/service/usergw/impl/http/Http2Dubbo.java @@ -0,0 +1,12 @@ +package cn.ecpark.service.usergw.impl.http; + +import org.springframework.web.bind.annotation.RestController; + +/** + * Http2Dubbo + */ +@RestController +public class Http2Dubbo { + + +} \ No newline at end of file