diff --git a/2-advanced/dubbo-samples-tengine/README.md b/2-advanced/dubbo-samples-tengine/README.md index 8451ee183e..024984f81e 100644 --- a/2-advanced/dubbo-samples-tengine/README.md +++ b/2-advanced/dubbo-samples-tengine/README.md @@ -10,16 +10,16 @@ git clone https://github.com/alibaba/tengine.git ``` cd ./tengine -wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz -tar xvf pcre-8.43.tar.gz +wget https://sourceforge.net/projects/pcre/files/pcre/8.43/pcre-8.43.tar.gz/download +tar xvf download wget https://www.openssl.org/source/openssl-1.0.2s.tar.gz tar xvf openssl-1.0.2s.tar.gz -wget http://www.zlib.net/zlib-1.2.11.tar.gz +wget https://www.zlib.net/fossils/zlib-1.2.11.tar.gz tar xvf zlib-1.2.11.tar.gz ``` - +ftp.pcre.org FTP site is no longer available. ### Build Tengine ``` ./configure --add-module=./modules/mod_dubbo --add-module=./modules/ngx_multi_upstream_module --add-module=./modules/mod_config --with-pcre=./pcre-8.43/ --with-openssl=./openssl-1.0.2s/ --with-zlib=./zlib-1.2.11 diff --git a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/pom.xml b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/pom.xml index 485134e812..ae9d80ab41 100644 --- a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/pom.xml +++ b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/pom.xml @@ -34,6 +34,31 @@ 3.1.6 + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.dubbo + dubbo-spring-boot-starter + ${dubbo.version} + + + org.apache.dubbo + dubbo-bom + ${dubbo.version} + pom + import + + + + org.apache.dubbo.sample @@ -53,10 +78,15 @@ junit test + + - org.springframework - spring-test - test + org.springframework.boot + spring-boot-starter + + + org.apache.dubbo + dubbo-spring-boot-starter diff --git a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/DemoServiceImpl.java b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/DemoServiceImpl.java index 2e33c4c985..f13745912c 100644 --- a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/DemoServiceImpl.java +++ b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/DemoServiceImpl.java @@ -16,8 +16,8 @@ */ package org.apache.dubbo.samples.tengine.provider; +import org.apache.dubbo.config.annotation.DubboService; import org.apache.dubbo.samples.tengine.DemoService; - import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.NameValuePair; @@ -39,6 +39,7 @@ import java.util.List; import java.util.Map; +@DubboService(registry="multicast") public class DemoServiceImpl implements DemoService { @Override public Map tengineDubbo(Map context) { diff --git a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/Provider.java b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/Provider.java index 97fbb11cd2..f71d064001 100644 --- a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/Provider.java +++ b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/java/org/apache/dubbo/samples/tengine/provider/Provider.java @@ -16,10 +16,15 @@ */ package org.apache.dubbo.samples.tengine.provider; +import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.util.concurrent.CountDownLatch; +@EnableDubbo +@SpringBootApplication public class Provider { /** @@ -28,9 +33,7 @@ public class Provider { * before running your application. */ public static void main(String[] args) throws Exception { - ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo-demo-provider.xml"}); - context.start(); - + SpringApplication.run(Provider.class,args); System.out.println("dubbo service started"); new CountDownLatch(1).await(); } diff --git a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml deleted file mode 100644 index 2943dc66e8..0000000000 --- a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/application.yml b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/application.yml new file mode 100644 index 0000000000..26979016fa --- /dev/null +++ b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/application.yml @@ -0,0 +1,25 @@ +# 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. + +dubbo: + application: + name: tengine-provider + protocol: + name: dubbo + port: 20880 + threads: 1024 + registry: + id : multicast + address: multicast://224.5.6.7:1234 \ No newline at end of file diff --git a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/docker/Dockerfile b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/docker/Dockerfile index 5b2e107efc..d68236ad19 100644 --- a/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/docker/Dockerfile +++ b/2-advanced/dubbo-samples-tengine/dubbo-samples-tengine-provider/src/main/resources/docker/Dockerfile @@ -25,11 +25,11 @@ ADD https://github.com/alibaba/tengine/archive/${TENGINE_VERSION}.tar.gz tengine RUN tar xvf tengine.tar.gz \ && cd ./tengine-${TENGINE_VERSION} \ - && wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz \ + && wget -O pcre-8.43.tar.gz https://sourceforge.net/projects/pcre/files/pcre/8.43/pcre-8.43.tar.gz/download \ && tar xvf pcre-8.43.tar.gz \ && wget https://www.openssl.org/source/openssl-1.0.2s.tar.gz \ && tar xvf openssl-1.0.2s.tar.gz \ - && wget http://www.zlib.net/zlib-1.2.11.tar.gz \ + && wget https://www.zlib.net/fossils/zlib-1.2.11.tar.gz \ && tar xvf zlib-1.2.11.tar.gz \ && ./configure --add-module=./modules/mod_dubbo --add-module=./modules/ngx_multi_upstream_module --add-module=./modules/mod_config --with-pcre=./pcre-8.43/ --with-openssl=./openssl-1.0.2s/ --with-zlib=./zlib-1.2.11 \ && make \ diff --git a/2-advanced/dubbo-samples-tengine/pom.xml b/2-advanced/dubbo-samples-tengine/pom.xml index 02daefd795..dc6476fa39 100644 --- a/2-advanced/dubbo-samples-tengine/pom.xml +++ b/2-advanced/dubbo-samples-tengine/pom.xml @@ -34,41 +34,6 @@ dubbo-samples-tengine-provider - - - - - org.springframework.boot - spring-boot-dependencies - ${spring-boot.version} - pom - import - - - org.apache.dubbo - dubbo-spring-boot-starter - ${dubbo.version} - - - org.apache.dubbo - dubbo-bom - ${dubbo.version} - pom - import - - - - - - - org.springframework.boot - spring-boot-starter - - - org.apache.dubbo - dubbo-spring-boot-starter - -