From 3be6c0f4fab7e179decb325f74e8c9b1b9ef6fe4 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 25 Mar 2019 11:49:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/docs/_sidebar.md | 11 ++--- ..._快速体验.md => 10010_快速体验.md} | 0 doc/docs/files/10011_项目接入到SOP.md | 41 +++++++++++++++++++ ..._新增接口.md => 10020_新增接口.md} | 5 +-- ...校验.md => 10030_业务参数校验.md} | 0 ..._错误处理.md => 10040_错误处理.md} | 0 ...详解.md => 10050_接口交互详解.md} | 0 7 files changed, 49 insertions(+), 8 deletions(-) rename doc/docs/files/{1001_快速体验.md => 10010_快速体验.md} (100%) create mode 100644 doc/docs/files/10011_项目接入到SOP.md rename doc/docs/files/{1002_新增接口.md => 10020_新增接口.md} (98%) rename doc/docs/files/{1003_业务参数校验.md => 10030_业务参数校验.md} (100%) rename doc/docs/files/{1004_错误处理.md => 10040_错误处理.md} (100%) rename doc/docs/files/{1005_接口交互详解.md => 10050_接口交互详解.md} (100%) diff --git a/doc/docs/_sidebar.md b/doc/docs/_sidebar.md index 88077343..eecfd729 100644 --- a/doc/docs/_sidebar.md +++ b/doc/docs/_sidebar.md @@ -1,7 +1,8 @@ * 文档目录 - * [快速体验](files/1001_快速体验.md?t=1553426189495) - * [新增接口](files/1002_新增接口.md?t=1553426189514) - * [业务参数校验](files/1003_业务参数校验.md?t=1553426189514) - * [错误处理](files/1004_错误处理.md?t=1553426189515) - * [接口交互详解](files/1005_接口交互详解.md?t=1553426189515) + * [快速体验](files/10010_快速体验.md?t=1553485733133) + * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1553485733154) + * [新增接口](files/10020_新增接口.md?t=1553485733154) + * [业务参数校验](files/10030_业务参数校验.md?t=1553485733154) + * [错误处理](files/10040_错误处理.md?t=1553485733154) + * [接口交互详解](files/10050_接口交互详解.md?t=1553485733155) diff --git a/doc/docs/files/1001_快速体验.md b/doc/docs/files/10010_快速体验.md similarity index 100% rename from doc/docs/files/1001_快速体验.md rename to doc/docs/files/10010_快速体验.md diff --git a/doc/docs/files/10011_项目接入到SOP.md b/doc/docs/files/10011_项目接入到SOP.md new file mode 100644 index 00000000..20450d37 --- /dev/null +++ b/doc/docs/files/10011_项目接入到SOP.md @@ -0,0 +1,41 @@ +# 项目接入到SOP + +以springboot项目为例,springmvc目前暂不支持,以后可以支持。 + +- 工程依赖sop-service-common,和eureka + +```xml + + com.gitee.sop + sop-service-common + 1.0.0-SNAPSHOT + + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + +``` + +- 配置文件添加eureka配置 + +```yaml +eureka: + port: 1111 # eureka端口号 + host: localhost # eureka地址 + client: + serviceUrl: + defaultZone: http://${eureka.host}:${eureka.port}/eureka/ +``` + +- 在springboot启动类上添加`@EnableDiscoveryClient` +- 新增一个配置类,继承`AlipayServiceConfiguration.java`,内容为空 + +```java +@Configuration +public class OpenServiceConfig extends AlipayServiceConfiguration { + +} +``` + +到此准备工作就完成了,接下来可前往`新增接口`查看如何新增接口。 diff --git a/doc/docs/files/1002_新增接口.md b/doc/docs/files/10020_新增接口.md similarity index 98% rename from doc/docs/files/1002_新增接口.md rename to doc/docs/files/10020_新增接口.md index 2e4aa5fa..a35f8339 100644 --- a/doc/docs/files/1002_新增接口.md +++ b/doc/docs/files/10020_新增接口.md @@ -109,9 +109,6 @@ public class StoryDemoTest extends TestBase { 如果想把现有项目中的接口开放出去,提供给客户调用,具体操作如下: -以springboot项目为例,springmvc目前暂不支持,以后可以支持。 - -- 将现有项目注册到注册中心 - 在现有接口方法上加上一个注解`@ApiAbility`,如下面这个接口 ```java @@ -126,6 +123,8 @@ public Story getStory2_0() { } ``` +- 启动程序 + 这种情况下,老接口依然能正常访问,同时开放平台也能访问进来。 **注意** 此时的开放接口对应的接口名为:类@RequestMapping.value + "." + 方法@RequestMapping.value diff --git a/doc/docs/files/1003_业务参数校验.md b/doc/docs/files/10030_业务参数校验.md similarity index 100% rename from doc/docs/files/1003_业务参数校验.md rename to doc/docs/files/10030_业务参数校验.md diff --git a/doc/docs/files/1004_错误处理.md b/doc/docs/files/10040_错误处理.md similarity index 100% rename from doc/docs/files/1004_错误处理.md rename to doc/docs/files/10040_错误处理.md diff --git a/doc/docs/files/1005_接口交互详解.md b/doc/docs/files/10050_接口交互详解.md similarity index 100% rename from doc/docs/files/1005_接口交互详解.md rename to doc/docs/files/10050_接口交互详解.md