Dubbo Initializer can be used to quickly generate Java project scaffolding, helping to simplify the setup, basic configuration, and component dependency management of microservice projects.
The Initializer is still being updated, and more support for Dubbo Features will be released gradually.
The Initializer will use dubbo-spring-boot-starter
to create Spring Boot projects, so we need to first choose the versions of Dubbo and Spring Boot.
Next, fill in the basic project information, including project coordinates, project name, package name, JDK version, etc.
There are two project structures to choose from: Single Module
and Multi Module
. In this example, we select Single Module
.
API
and Service
modules, where API
is for storing Dubbo service definitions, and Service
is for service implementations or calling logic. Generally, multi-module is more conducive to independent management and publishing of service definitions.We default the following dependencies for the template:
Based on the above options, the generated project will use Zookeeper as the registry, high-performance Dubbo2 TCP protocol for RPC communication, and increase dependencies and examples for components like Web, Mybatis, etc.
Note: The above-selected Dubbo components are also default options, meaning that unless manual dependencies are added, clicking code generation directly on the page will include the above Dubbo components in the generated code.
If manually adding dependency components, please pay attention to the inherent combination relationship limits between the various Dubbo dependency components, for example:
- If you select 【Dubbo Service API】-【IDL】, it currently only supports selecting 【HTTP/2】 or 【gRPC】 protocols from 【Dubbo Protocol】.
- Within the same dependency group, only one dependency of the same type can be selected, e.g., from the registry perspective under the 【Dubbo Registry&Config&Metadata】 group, only one of 【Zookeeper】 or 【Nacos】 can be selected. If you want to set multiple registries, please manually modify the configuration in the generated code. However, registry and configuration centers can each select one, such as Zookeeper and Apollo can be selected together.
After downloading the project to your local machine, unzip it and import it into your IDE to develop customized Dubbo applications as needed.