Create a Dubbo Spring Boot Microservice in 1 Minute with Dubbo Initializer
This guide walks you through using the Dubbo Initializer web UI to quickly generate a ready‑to‑run Dubbo Spring Boot microservice project, covering version selection, project metadata, module structure, dependency choices, code generation, download, and a brief walkthrough of the generated source files.
Overview
Dubbo Initializer is a web‑based UI that scaffolds a Dubbo Spring Boot project. It generates a Maven project with basic Dubbo configuration, example service code, and optional microservice components such as Web, MyBatis, and a template engine. The result is provided as a downloadable ZIP archive.
Accessing the Initializer
Open a browser and navigate to https://start.dubbo.apache.org/. The main page displays the project creation wizard.
Select Dubbo and Spring Boot Versions
The wizard builds the project with dubbo-spring-boot-starter. Choose a Dubbo version that is compatible with the selected Spring Boot version; the UI lists compatible pairs.
Enter Project Metadata
Provide the Maven coordinates (groupId, artifactId), project name, base package, and the JDK version to be used. These values are written into the generated pom.xml and source package structure.
Choose Project Structure
Single‑module : all source code resides in one Maven module; simplest layout.
Multi‑module : generates separate api and service modules, allowing independent management of service definitions.
Select Dependency Components
By default the initializer includes the following dependencies:
Dubbo core components: Java interface, Zookeeper registry, Dubbo2 TCP protocol.
Common microservice libraries: Spring Boot Web starter, MyBatis Spring Boot starter, Thymeleaf template engine, Spring Boot JDBC starter.
These choices result in a pom.xml that contains the corresponding <dependency> entries and a application.yml that configures the Dubbo application, protocol, and registry.
Generate and Download the Project
Click “Browse Code” to view the generated project structure and source files directly in the browser.
Click “Download Code” to obtain a ZIP file containing the complete Maven project.
After extracting the archive, import the project into an IDE (e.g., IntelliJ IDEA or Eclipse) and run it with mvn spring-boot:run or your IDE’s run configuration.
Sample Generated Code
1. Service Definition
public interface DemoService {
String hello(String arg);
}2. Service Implementation
@DubboService
public class DemoServiceImpl implements DemoService {
@Override
public String hello(String arg) {
// put your microservice logic here
return "Hello " + arg;
}
}3. Application Configuration (YAML)
dubbo:
application:
name: dubbo-demo
protocol:
name: dubbo
port: -1
registry:
address: zookeeper://127.0.0.1:21814. Maven Dependencies
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>Dependency Constraints and Caveats
Only one registry can be selected per generated project (e.g., Zookeeper or Nacos). To use multiple registries, edit the generated application.yml manually.
If the Dubbo Service API is generated with an IDL, only HTTP/2 or gRPC protocols are currently supported.
Future Enhancements (Technical Scope)
The initializer roadmap includes tighter integration with the official Apache Dubbo plugin for IntelliJ IDEA (available at https://plugins.jetbrains.com/plugin/20938-apache-dubbo-in-spring-framework) and the development of “Dubbo Boot Starters” that provide zero‑configuration usage of Dubbo via dedicated starter dependencies.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Native
We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
