mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 12:56:28 +08:00
添加文档
This commit is contained in:
@@ -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)
|
||||
|
41
doc/docs/files/10011_项目接入到SOP.md
Normal file
41
doc/docs/files/10011_项目接入到SOP.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# 项目接入到SOP
|
||||
|
||||
以springboot项目为例,springmvc目前暂不支持,以后可以支持。
|
||||
|
||||
- 工程依赖sop-service-common,和eureka
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-service-common</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- 配置文件添加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 {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
到此准备工作就完成了,接下来可前往`新增接口`查看如何新增接口。
|
@@ -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
|
Reference in New Issue
Block a user