dubbo-admin 接口文档

摘要 

属于 :API 标签: 发布于:2021-07-20 23:49:42



dubbo依赖

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.demo</groupId>
  <artifactId>dubbosprovider</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.3.3.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
  <name>dubbosprovider</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   
        <dubbo.version>2.7.8</dubbo.version>
    </properties>

    <dependencies>
         <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo</artifactId>
        <version>${dubbo.version}</version>
    </dependency>
    <!-- <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo-dependencies-zookeeper</artifactId>
        <version>${dubbo.version}</version>
        <type>pom</type>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
        </exclusions>
    </dependency> -->
     <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-configcenter-zookeeper</artifactId>
        <version>${dubbo.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
        </exclusions>
        </dependency>
         <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-metadata-report-zookeeper</artifactId>
        <version>${dubbo.version}</version>
        </dependency>
         <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-rpc-dubbo</artifactId>
             <version>${dubbo.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-config-spring</artifactId>
             <version>${dubbo.version}</version>
        </dependency>
       
        
      <!-- springboot -->
     <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
     </dependency>
     
     <!-- dubbo api -->
     <dependency>
    <groupId>org.apache.dubbo</groupId>
    <artifactId>dubbo-api-docs-annotations</artifactId>
    <version>2.7.8.2</version>
</dependency>

<dependency>
    <groupId>org.apache.dubbo</groupId>
    <artifactId>dubbo-api-docs-core</artifactId>
    <version>2.7.8.2</version>
</dependency>
  </dependencies>
  
   <build> 
    </build>
</project>

application.properties

server.port=8092

dubbo.application.name=demoProvider
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.metadata-report.address=zookeeper://127.0.0.1:2181
dubbo.protocol.name=dubbo
dubbo.application.qos.port=22222
@EnableAutoConfiguration
@ComponentScan(basePackages = {"com.demo"})
@EnableDubboApiDocs
//@Profile("dev")
//@ImportResource({"classpath:dubbo-provider.xml"})

//@SpringBootApplication
@EnableDubbo(scanBasePackages = {"com.demo"})
public class Application {
     
    public static void main(String[] args) throws Exception { 
        SpringApplication.run(Application.class, args);
    }
    }


greetingServiceImpl

@DubboService(version="v1",group="demoGroup")
@ApiModule(value = "Greeting demo", apiInterface = GreetingsService.class)
public class GreetingsServiceImpl implements GreetingsService {
	@ApiDoc(value = "sayHi demo", description = "this api is a quick start demo")
	@Override
    public String sayHi(String name) {
        return "hi, " + name;
    }
}


dubbo-admin-0.3

application.properties

#
# 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.
#

# centers in dubbo2.7, if you want to add parameters, please add them to the url
admin.registry.address=zookeeper://127.0.0.1:2181
admin.config-center=zookeeper://127.0.0.1:2181
admin.metadata-report.address=zookeeper://127.0.0.1:2181

# nacos config, add parameters to url like username=nacos&password=nacos
#admin.registry.address=nacos://127.0.0.1:8848?group=DEFAULT_GROUP&namespace=public
#admin.config-center=nacos://127.0.0.1:8848?group=dubbo
#admin.metadata-report.address=nacos://127.0.0.1:8848?group=dubbo

#group (Deprecated it is recommended to use URL to add parameters,will be removed in the future)
#admin.registry.group=dubbo
#admin.config-center.group=dubbo
#admin.metadata-report.group=dubbo

#namespace used by nacos. (Deprecated it is recommended to use URL to add parameters,will be removed in the future)
#admin.registry.namespace=public
#admin.config-center.namespace=public
#admin.metadata-report.namespace=public

admin.root.user.name=root
admin.root.user.password=root

#session timeout, default is one hour
admin.check.sessionTimeoutMilli=3600000


# apollo config
# admin.config-center = apollo://localhost:8070?token=e16e5cd903fd0c97a116c873b448544b9d086de9&app.id=test&env=dev&cluster=default&namespace=dubbo

# (Deprecated it is recommended to use URL to add parameters,will be removed in the future)
#admin.apollo.token=e16e5cd903fd0c97a116c873b448544b9d086de9
#admin.apollo.appId=test
#admin.apollo.env=dev
#admin.apollo.cluster=default
#admin.apollo.namespace=dubbo

#compress
server.compression.enabled=true
server.compression.mime-types=text/css,text/javascript,application/javascript
server.compression.min-response-size=10240


dubbo.api.docs.group=
dubbo.api.docs.version=
# 上面两行非常重要

编译好后运行dubbo-admin-0.3

cd C:\Users\Administrator\Downloads\dubbo-admin-develop\dubbo-admin-distribution\target

java -jar dubbo-admin-0.3.0-SNAPSHOT.jar


接口文档,提供者端口:20880