This is an automated email from the ASF dual-hosted git repository. albumenj pushed a commit to branch 3.3 in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.3 by this push: new 55b6d170d9 Fix the triple protocol request failed in the native scenario (#13984) 55b6d170d9 is described below commit 55b6d170d9ad5ba29b0f512281e187bc789e1a02 Author: huazhongming <crazy...@gmail.com> AuthorDate: Tue Mar 26 19:13:58 2024 +0800 Fix the triple protocol request failed in the native scenario (#13984) Signed-off-by: crazyhzm <crazy...@gmail.com> --- .../protocol/tri/TripleScopeModelInitializer.java | 41 ++++++++++++++++++++++ ...rg.apache.dubbo.rpc.model.ScopeModelInitializer | 1 + 2 files changed, 42 insertions(+) diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleScopeModelInitializer.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleScopeModelInitializer.java new file mode 100644 index 0000000000..1811821438 --- /dev/null +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleScopeModelInitializer.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.rpc.protocol.tri; + +import org.apache.dubbo.common.beans.factory.ScopeBeanFactory; +import org.apache.dubbo.rpc.model.ApplicationModel; +import org.apache.dubbo.rpc.model.FrameworkModel; +import org.apache.dubbo.rpc.model.ModuleModel; +import org.apache.dubbo.rpc.model.ScopeModelInitializer; +import org.apache.dubbo.rpc.protocol.tri.rest.mapping.DefaultRequestMappingRegistry; +import org.apache.dubbo.rpc.protocol.tri.route.DefaultRequestRouter; + +public class TripleScopeModelInitializer implements ScopeModelInitializer { + + @Override + public void initializeFrameworkModel(FrameworkModel frameworkModel) { + ScopeBeanFactory beanFactory = frameworkModel.getBeanFactory(); + beanFactory.registerBean(DefaultRequestMappingRegistry.class); + beanFactory.registerBean(DefaultRequestRouter.class); + } + + @Override + public void initializeApplicationModel(ApplicationModel applicationModel) {} + + @Override + public void initializeModuleModel(ModuleModel moduleModel) {} +} diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.model.ScopeModelInitializer b/dubbo-rpc/dubbo-rpc-triple/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.model.ScopeModelInitializer new file mode 100644 index 0000000000..65af7ec222 --- /dev/null +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.model.ScopeModelInitializer @@ -0,0 +1 @@ +dubbo-rpc-triple=org.apache.dubbo.rpc.protocol.tri.TripleScopeModelInitializer