[apache/dubbo]如何在https://github.com/apache中找到dubbo+springboot的pom.xml配置标准代码啊?

2024-07-02 8 views
5

百度上面的一个BLOG一个样

想找官方标准的,

而https://github.com/apache/dubbo-spring-boot-project项目又废弃了,我在https://github.com/apache中没有找到。

求助!

回答

6

我现在的parent项目使用:

    <dependencyManagement>
        <dependencies>
            <!-- Spring Boot -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Apache Dubbo  -->
            <dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-dependencies-bom</artifactId>
                <version>${dubbo.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>

        <!-- Dubbo Spring Boot Starter -->
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-spring-boot-starter</artifactId>
            <version>${dubbo.version}</version>
        </dependency>
    </dependencies>

子模块使用:

    <parent>
        <artifactId>my-parent</artifactId>
        <groupId>com.ghy.www</groupId>
        <version>1.0-RELEASE</version>
        <relativePath>../my-parent/pom.xml</relativePath>
    </parent>

    <dependencies>
        <!-- Spring Boot dependencies -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-spring-boot-starter</artifactId>
            <version>${dubbo.version}</version>
        </dependency>

        <!-- Zookeeper dependencies -->
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-dependencies-zookeeper</artifactId>
            <version>${dubbo.version}</version>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>com.ghy.www</groupId>
            <artifactId>my-api</artifactId>
            <version>1.0-RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

我这种写法不知道是不是最佳实践。有什么需要改进的地方。

1

@plusmancn mark

6

是的,这个项目 已经作废了 ,官方没有基于spring-boot的最新版dubbo3.0.3依赖pom.xml配置标准模板代码。

5

@plusmancn 我还是没有找到模板代码,在8666中,如何找到呢。感谢。

1

https://github.com/apache/dubbo-spring-boot-project This project has been migrated to the current dubbo warehouse. The posture is the same as the previous posture. The version can depend on the version of dubbo, such as the latest 3.0.2.1.

   <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo-spring-boot-starter</artifactId>
        <version>3.0.2.1</version>
    </dependency>