You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# 项目接入到SOP
|
|
|
|
|
|
|
|
以springboot项目为例,springmvc目前暂不支持,以后可以支持。
|
|
|
|
|
|
|
|
- pom.xml添加SpringCloud支持
|
|
|
|
|
|
|
|
```xml
|
|
|
|
<dependencyManagement>
|
|
|
|
<dependencies>
|
|
|
|
<dependency>
|
|
|
|
<groupId>org.springframework.cloud</groupId>
|
|
|
|
<artifactId>spring-cloud-dependencies</artifactId>
|
|
|
|
<version>Greenwich.RELEASE</version>
|
|
|
|
<type>pom</type>
|
|
|
|
<scope>import</scope>
|
|
|
|
</dependency>
|
|
|
|
</dependencies>
|
|
|
|
</dependencyManagement>
|
|
|
|
```
|
|
|
|
|
|
|
|
- pom.xml依赖sop-service-common和eureka
|
|
|
|
|
|
|
|
```xml
|
|
|
|
<dependency>
|
|
|
|
<groupId>com.gitee.sop</groupId>
|
|
|
|
<artifactId>sop-service-common</artifactId>
|
|
|
|
<version>最新版本</version>
|
|
|
|
</dependency>
|
|
|
|
|
|
|
|
<dependency>
|
|
|
|
<groupId>org.springframework.cloud</groupId>
|
|
|
|
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
|
|
|
</dependency>
|
|
|
|
```
|
|
|
|
|
|
|
|
- application.properties配置文件添加
|
|
|
|
|
|
|
|
```properties
|
|
|
|
server.port=2222
|
|
|
|
# 服务名称
|
|
|
|
spring.application.name=story-service
|
|
|
|
# eureka注册中心
|
|
|
|
eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/
|
|
|
|
# zookeeper配置
|
|
|
|
spring.cloud.zookeeper.connect-string=localhost:2181
|
|
|
|
```
|
|
|
|
|
|
|
|
- 在springboot启动类上添加`@EnableDiscoveryClient`
|
|
|
|
- 新增一个配置类,继承`AlipayServiceConfiguration.java`,内容为空
|
|
|
|
|
|
|
|
```java
|
|
|
|
@Configuration
|
|
|
|
public class OpenServiceConfig extends AlipayServiceConfiguration {
|
|
|
|
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
到此准备工作就完成了,接下来可前往`新增接口`查看如何新增接口。
|