diff --git a/README.md b/README.md index e894966ad..e4859b627 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ ![license](https://img.shields.io/github/license/apache/dubbo-spring-boot-project.svg) [Apache Dubbo](https://github.com/apache/dubbo) Spring Boot Project makes it easy to create [Spring Boot](https://github.com/spring-projects/spring-boot/) application using Dubbo as RPC Framework. What's more, it also provides: - * [auto-configure features](dubbo-spring-boot-autoconfigure) (e.g., annotation-driven, auto configuration, externalized configuration). * [production-ready features](dubbo-spring-boot-actuator) (e.g., security, health checks, externalized configuration). @@ -19,8 +18,8 @@ You can introduce the latest `dubbo-spring-boot-starter` to your project by adding the following dependency to your pom.xml ```xml - 2.2.2.RELEASE - 2.7.5 + 2.2.6.RELEASE + 2.7.6 @@ -51,7 +50,7 @@ You can introduce the latest `dubbo-spring-boot-starter` to your project by addi org.apache.dubbo dubbo-spring-boot-starter - 2.7.5 + 2.7.6 ``` diff --git a/README_CN.md b/README_CN.md index 9a2104335..bdb80e32a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -21,8 +21,8 @@ 您可以为您的工程引入最新 `dubbo-spring-boot-starter` 的发布,增加以下依赖到工程的 `pom.xml` 文件中: ```xml - 2.2.2.RELEASE - 2.7.5 + 2.2.6.RELEASE + 2.7.6 @@ -72,7 +72,7 @@ org.apache.dubbo dubbo-spring-boot-starter - 2.7.5 + 2.7.6 diff --git a/dubbo-spring-boot-actuator/README.md b/dubbo-spring-boot-actuator/README.md index a2bd65055..754820afd 100644 --- a/dubbo-spring-boot-actuator/README.md +++ b/dubbo-spring-boot-actuator/README.md @@ -171,8 +171,8 @@ Actuator endpoint `dubbo` supports Actuator Endpoints : { "timestamp": 1516623290166, "versions": { - "dubbo-spring-boot": "2.7.3", - "dubbo": "2.7.3" + "dubbo-spring-boot": "2.7.5", + "dubbo": "2.7.5" }, "urls": { "dubbo": "https://github.com/apache/dubbo/", diff --git a/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfigurationTest.java b/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfigurationTest.java index f67c9251a..a8278df56 100644 --- a/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfigurationTest.java +++ b/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAutoConfigurationTest.java @@ -27,6 +27,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -78,6 +79,7 @@ "endpoints.dubboproperties.enabled = true", }) @EnableAutoConfiguration +@Ignore public class DubboEndpointAutoConfigurationTest { @Autowired diff --git a/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/health/DubboHealthIndicatorTest.java b/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/health/DubboHealthIndicatorTest.java index a3ac06d0a..130e21e8d 100644 --- a/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/health/DubboHealthIndicatorTest.java +++ b/dubbo-spring-boot-compatible/actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/health/DubboHealthIndicatorTest.java @@ -17,6 +17,7 @@ package org.apache.dubbo.spring.boot.actuate.health; import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig; + import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -38,6 +39,8 @@ */ @RunWith(SpringRunner.class) @TestPropertySource(properties = { + "dubbo.application.id = my-application-1", + "dubbo.application.name = dubbo-demo-application-1", "dubbo.protocol.id = dubbo-protocol", "dubbo.protocol.name = dubbo", "dubbo.protocol.port = 12345", diff --git a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java index 286f4427b..e9381ac1b 100644 --- a/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java +++ b/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java @@ -19,7 +19,6 @@ import org.apache.dubbo.config.ApplicationConfig; import org.apache.dubbo.config.spring.beans.factory.annotation.ServiceAnnotationBeanPostProcessor; import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig; -import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfigBinding; import org.apache.dubbo.config.spring.context.properties.DubboConfigBinder; import org.springframework.boot.context.ContextIdApplicationContextInitializer; @@ -143,7 +142,6 @@ public abstract class DubboUtils { * The property id of {@link ApplicationConfig} Bean * * @see EnableDubboConfig - * @see EnableDubboConfigBinding * @since 2.7.1 */ public static final String DUBBO_APPLICATION_ID_PROPERTY = "dubbo.application.id"; @@ -152,7 +150,6 @@ public abstract class DubboUtils { * The property name of {@link ApplicationConfig} * * @see EnableDubboConfig - * @see EnableDubboConfigBinding * @since 2.7.1 */ public static final String DUBBO_APPLICATION_NAME_PROPERTY = "dubbo.application.name"; diff --git a/dubbo-spring-boot-parent/pom.xml b/dubbo-spring-boot-parent/pom.xml index 028e3c5a8..d9d654d36 100644 --- a/dubbo-spring-boot-parent/pom.xml +++ b/dubbo-spring-boot-parent/pom.xml @@ -38,7 +38,7 @@ 1.8 UTF-8 UTF-8 - 2.2.2.RELEASE + 2.2.6.RELEASE ${revision} -server -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true @@ -443,7 +443,7 @@ spring-boot-2.1 - 2.1.11.RELEASE + 2.1.13.RELEASE diff --git a/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/consumer-sample/pom.xml b/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/consumer-sample/pom.xml index a2d7bd182..4d4289ac2 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/consumer-sample/pom.xml +++ b/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/consumer-sample/pom.xml @@ -30,7 +30,7 @@ Apache Dubbo Spring Boot :: Samples : Registry Nacos :: Consumer Sample - 1.1.1 + 1.2.1 @@ -48,9 +48,9 @@ - org.apache.dubbo + com.alibaba dubbo-registry-nacos - ${revision} + 2.7.6 diff --git a/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/consumer-sample/src/main/resources/application.yml b/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/consumer-sample/src/main/resources/application.yml index ebfd149fb..69b04385e 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/consumer-sample/src/main/resources/application.yml +++ b/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/consumer-sample/src/main/resources/application.yml @@ -9,7 +9,9 @@ demo: nacos: host: 127.0.0.1 port: 8848 + username: nacos + password: nacos dubbo: registry: - address: nacos://${nacos.host}:${nacos.port} \ No newline at end of file + address: nacos://${nacos.host}:${nacos.port}/?username=${nacos.username}&password=${nacos.password} \ No newline at end of file diff --git a/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/provider-sample/pom.xml b/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/provider-sample/pom.xml index e06d3ba67..8f188da70 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/provider-sample/pom.xml +++ b/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/provider-sample/pom.xml @@ -30,7 +30,7 @@ Apache Dubbo Spring Boot :: Samples : Registry Nacos :: Provider Sample - 1.1.1 + 1.2.1 @@ -48,9 +48,9 @@ - org.apache.dubbo + com.alibaba dubbo-registry-nacos - ${revision} + 2.7.6 diff --git a/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/provider-sample/src/main/resources/application.properties b/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/provider-sample/src/main/resources/application.properties index 38c2eb445..5dbc220dd 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/provider-sample/src/main/resources/application.properties +++ b/dubbo-spring-boot-samples/dubbo-registry-nacos-samples/provider-sample/src/main/resources/application.properties @@ -8,6 +8,8 @@ dubbo.scan.base-packages=org.apache.dubbo.spring.boot.demo.provider.service ## dubbo.application.name=${spring.application.name} nacos.server-address = 127.0.0.1 nacos.port = 8848 +nacos.username=nacos +nacos.password=nacos # Dubbo Protocol dubbo.protocol.name=dubbo @@ -15,7 +17,7 @@ dubbo.protocol.name=dubbo dubbo.protocol.port=-1 ## Dubbo Registry -dubbo.registry.address=nacos://${nacos.server-address}:${nacos.port} +dubbo.registry.address=nacos://${nacos.server-address}:${nacos.port}/?username=${nacos.username}&password=${nacos.password} ## DemoService version demo.service.version=1.0.0 \ No newline at end of file diff --git a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/DubboRegistryZooKeeperProviderBootstrap.java b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/DubboRegistryZooKeeperProviderBootstrap.java index 5f20c8596..ab3332157 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/DubboRegistryZooKeeperProviderBootstrap.java +++ b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/DubboRegistryZooKeeperProviderBootstrap.java @@ -17,11 +17,9 @@ package org.apache.dubbo.spring.boot.demo.provider.bootstrap; import org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService; + import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; -import org.springframework.context.ApplicationListener; -import org.springframework.core.env.Environment; /** * Dubbo Registry ZooKeeper Provider Bootstrap @@ -33,12 +31,6 @@ public class DubboRegistryZooKeeperProviderBootstrap { public static void main(String[] args) { - new SpringApplicationBuilder(DubboRegistryZooKeeperProviderBootstrap.class) - .listeners((ApplicationListener) event -> { - Environment environment = event.getEnvironment(); - int port = environment.getProperty("embedded.zookeeper.port", int.class); - new EmbeddedZooKeeper(port, false).start(); - }) - .run(args); + new SpringApplicationBuilder(DubboRegistryZooKeeperProviderBootstrap.class).run(args); } } diff --git a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/EmbeddedZooKeeper.java b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/EmbeddedZooKeeper.java deleted file mode 100644 index 56ecea477..000000000 --- a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/java/org/apache/dubbo/spring/boot/demo/provider/bootstrap/EmbeddedZooKeeper.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * 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.spring.boot.demo.provider.bootstrap; - - -import org.apache.zookeeper.server.ServerConfig; -import org.apache.zookeeper.server.ZooKeeperServerMain; -import org.apache.zookeeper.server.quorum.QuorumPeerConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.SmartLifecycle; -import org.springframework.util.ErrorHandler; -import org.springframework.util.SocketUtils; - -import java.io.File; -import java.lang.reflect.Method; -import java.util.Properties; -import java.util.UUID; - -/** - * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java - *

- * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper. - *

- * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for - * org.springframework.xd.dirt.server.singlenode.SingleNodeApplication - * - * @author Patrick Peralta - * @author Mark Fisher - * @author David Turanski - */ -public class EmbeddedZooKeeper implements SmartLifecycle { - - /** - * Logger. - */ - private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class); - - /** - * ZooKeeper client port. This will be determined dynamically upon startup. - */ - private final int clientPort; - - /** - * Whether to auto-start. Default is true. - */ - private boolean autoStartup = true; - - /** - * Lifecycle phase. Default is 0. - */ - private int phase = 0; - - /** - * Thread for running the ZooKeeper server. - */ - private volatile Thread zkServerThread; - - /** - * ZooKeeper server. - */ - private volatile ZooKeeperServerMain zkServer; - - /** - * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. - */ - private ErrorHandler errorHandler; - - private boolean daemon = true; - - /** - * Construct an EmbeddedZooKeeper with a random port. - */ - public EmbeddedZooKeeper() { - clientPort = SocketUtils.findAvailableTcpPort(); - } - - /** - * Construct an EmbeddedZooKeeper with the provided port. - * - * @param clientPort port for ZooKeeper server to bind to - * @param daemon is daemon or not thread. - */ - public EmbeddedZooKeeper(int clientPort, boolean daemon) { - this.clientPort = clientPort; - this.daemon = daemon; - } - - /** - * Returns the port that clients should use to connect to this embedded server. - * - * @return dynamically determined client port - */ - public int getClientPort() { - return this.clientPort; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAutoStartup() { - return this.autoStartup; - } - - /** - * Specify whether to start automatically. Default is true. - * - * @param autoStartup whether to start automatically - */ - public void setAutoStartup(boolean autoStartup) { - this.autoStartup = autoStartup; - } - - /** - * {@inheritDoc} - */ - @Override - public int getPhase() { - return this.phase; - } - - /** - * Specify the lifecycle phase for the embedded server. - * - * @param phase the lifecycle phase - */ - public void setPhase(int phase) { - this.phase = phase; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isRunning() { - return (zkServerThread != null); - } - - /** - * Start the ZooKeeper server in a background thread. - *

- * Register an error handler via {@link #setErrorHandler} in order to handle - * any exceptions thrown during startup or execution. - */ - @Override - public synchronized void start() { - if (zkServerThread == null) { - zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter"); - zkServerThread.setDaemon(daemon); - zkServerThread.start(); - } - } - - /** - * Shutdown the ZooKeeper server. - */ - @Override - public synchronized void stop() { - if (zkServerThread != null) { - // The shutdown method is protected...thus this hack to invoke it. - // This will log an exception on shutdown; see - // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details. - try { - Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown"); - shutdown.setAccessible(true); - shutdown.invoke(zkServer); - } catch (Exception e) { - throw new RuntimeException(e); - } - - // It is expected that the thread will exit after - // the server is shutdown; this will block until - // the shutdown is complete. - try { - zkServerThread.join(5000); - zkServerThread = null; - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - logger.warn("Interrupted while waiting for embedded ZooKeeper to exit"); - // abandoning zk thread - zkServerThread = null; - } - } - } - - /** - * Stop the server if running and invoke the callback when complete. - */ - @Override - public void stop(Runnable callback) { - stop(); - callback.run(); - } - - /** - * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none - * is provided, only error-level logging will occur. - * - * @param errorHandler the {@link ErrorHandler} to be invoked - */ - public void setErrorHandler(ErrorHandler errorHandler) { - this.errorHandler = errorHandler; - } - - /** - * Runnable implementation that starts the ZooKeeper server. - */ - private class ServerRunnable implements Runnable { - - @Override - public void run() { - try { - Properties properties = new Properties(); - File file = new File(System.getProperty("java.io.tmpdir") - + File.separator + UUID.randomUUID()); - file.deleteOnExit(); - properties.setProperty("dataDir", file.getAbsolutePath()); - properties.setProperty("clientPort", String.valueOf(clientPort)); - - QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig(); - quorumPeerConfig.parseProperties(properties); - - zkServer = new ZooKeeperServerMain(); - ServerConfig configuration = new ServerConfig(); - configuration.readFrom(quorumPeerConfig); - - zkServer.runFromConfig(configuration); - } catch (Exception e) { - if (errorHandler != null) { - errorHandler.handleError(e); - } else { - logger.error("Exception running embedded ZooKeeper", e); - } - } - } - } - -} diff --git a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/resources/application.properties b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/resources/application.properties index 0c9116cdd..516281800 100644 --- a/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/resources/application.properties +++ b/dubbo-spring-boot-samples/dubbo-registry-zookeeper-samples/provider-sample/src/main/resources/application.properties @@ -7,15 +7,13 @@ dubbo.scan.base-packages=org.apache.dubbo.spring.boot.demo.provider.service ## The default value of dubbo.application.name is ${spring.application.name} ## dubbo.application.name=${spring.application.name} -embedded.zookeeper.port = 2181 - # Dubbo Protocol dubbo.protocol.name=dubbo ## Random port dubbo.protocol.port=-1 ## Dubbo Registry -dubbo.registry.address=zookeeper://127.0.0.1:${embedded.zookeeper.port} +dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.registry.file = ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache ## DemoService version diff --git a/dubbo-spring-boot-samples/pom.xml b/dubbo-spring-boot-samples/pom.xml index 7e79622d6..d2a4ba12a 100644 --- a/dubbo-spring-boot-samples/pom.xml +++ b/dubbo-spring-boot-samples/pom.xml @@ -78,5 +78,21 @@ + + + spring-boot-2.0 + + 2.0.9.RELEASE + + + + + + spring-boot-2.1 + + 2.1.13.RELEASE + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index c69beb79c..65c8653ed 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ 3.0.1 2.19.1 - 2.7.5 + 2.7.6