Skip to content

Commit 2125c25

Browse files
authored
Merge pull request #12 from coderqianlq/dev
refactor(依赖): module建立父子依赖
2 parents 2b2b238 + 5cf40df commit 2125c25

File tree

17 files changed

+87
-321
lines changed

17 files changed

+87
-321
lines changed

api-gateway/pom.xml

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>com.coderqian</groupId>
76
<artifactId>api-gateway</artifactId>
87
<version>0.0.1-SNAPSHOT</version>
98
<packaging>jar</packaging>
@@ -12,31 +11,12 @@
1211
<description>Demo project for Spring Boot</description>
1312

1413
<parent>
15-
<groupId>org.springframework.boot</groupId>
16-
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.5.9.RELEASE</version>
18-
<relativePath/> <!-- lookup parent from repository -->
14+
<groupId>com.coderqian</groupId>
15+
<artifactId>spring-cloud-cli</artifactId>
16+
<version>1.0-SNAPSHOT</version>
1917
</parent>
2018

21-
<properties>
22-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23-
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24-
<java.version>1.8</java.version>
25-
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
26-
</properties>
27-
2819
<dependencies>
29-
<dependency>
30-
<groupId>org.springframework.boot</groupId>
31-
<artifactId>spring-boot-starter</artifactId>
32-
</dependency>
33-
34-
<dependency>
35-
<groupId>org.springframework.boot</groupId>
36-
<artifactId>spring-boot-starter-test</artifactId>
37-
<scope>test</scope>
38-
</dependency>
39-
4020
<dependency>
4121
<groupId>org.springframework.cloud</groupId>
4222
<artifactId>spring-cloud-starter-zuul</artifactId>
@@ -51,29 +31,6 @@
5131
<!--<groupId>org.springframework.cloud</groupId>-->
5232
<!--<artifactId>spring-cloud-starter-ribbon</artifactId>-->
5333
<!--</dependency>-->
54-
5534
</dependencies>
5635

57-
<dependencyManagement>
58-
<dependencies>
59-
<dependency>
60-
<groupId>org.springframework.cloud</groupId>
61-
<artifactId>spring-cloud-dependencies</artifactId>
62-
<version>${spring-cloud.version}</version>
63-
<type>pom</type>
64-
<scope>import</scope>
65-
</dependency>
66-
</dependencies>
67-
</dependencyManagement>
68-
69-
<build>
70-
<plugins>
71-
<plugin>
72-
<groupId>org.springframework.boot</groupId>
73-
<artifactId>spring-boot-maven-plugin</artifactId>
74-
</plugin>
75-
</plugins>
76-
</build>
77-
78-
7936
</project>

api-gateway/src/main/resources/application.properties

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@ eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka
66
zuul.ignoredServices='*'
77

88
#zuul.routes.api-a.path=/customer/**
9-
#zuul.routes.api-a.serviceId=eureka-customer
9+
#zuul.routes.api-a.serviceId=service-customer
1010

1111
#zuul.routes.api-b.path=/order/**
12-
#zuul.routes.api-b.serviceId=eureka-order
12+
#zuul.routes.api-b.serviceId=service-order
1313

1414
# 由网关分发到feign,再经feign负载均衡
15-
zuul.routes.api-c.path=/feign/**
16-
zuul.routes.api-c.serviceId=feign-server
15+
zuul.routes.api-c.path=/feign/**
16+
zuul.routes.api-c.serviceId=feign-server
1717

18-
#请求连接的超时时间
19-
#ribbon.ConnectTimeout=6000
20-
#请求处理的超时时间
21-
#ribbon.ReadTimeout=6000
18+
#ribbon.ReadTimeout=60000
19+
#ribbon.ConnectTimeout=60000

config-server/pom.xml

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>com.coderqian</groupId>
76
<artifactId>config-server</artifactId>
87
<version>0.0.1-SNAPSHOT</version>
98
<packaging>jar</packaging>
@@ -12,52 +11,16 @@
1211
<description>Demo project for Spring Boot</description>
1312

1413
<parent>
15-
<groupId>org.springframework.boot</groupId>
16-
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.5.9.RELEASE</version>
18-
<relativePath/> <!-- lookup parent from repository -->
14+
<groupId>com.coderqian</groupId>
15+
<artifactId>spring-cloud-cli</artifactId>
16+
<version>1.0-SNAPSHOT</version>
1917
</parent>
2018

21-
<properties>
22-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23-
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24-
<java.version>1.8</java.version>
25-
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
26-
</properties>
27-
2819
<dependencies>
2920
<dependency>
3021
<groupId>org.springframework.cloud</groupId>
3122
<artifactId>spring-cloud-config-server</artifactId>
3223
</dependency>
33-
34-
<dependency>
35-
<groupId>org.springframework.boot</groupId>
36-
<artifactId>spring-boot-starter-test</artifactId>
37-
<scope>test</scope>
38-
</dependency>
3924
</dependencies>
4025

41-
<dependencyManagement>
42-
<dependencies>
43-
<dependency>
44-
<groupId>org.springframework.cloud</groupId>
45-
<artifactId>spring-cloud-dependencies</artifactId>
46-
<version>${spring-cloud.version}</version>
47-
<type>pom</type>
48-
<scope>import</scope>
49-
</dependency>
50-
</dependencies>
51-
</dependencyManagement>
52-
53-
<build>
54-
<plugins>
55-
<plugin>
56-
<groupId>org.springframework.boot</groupId>
57-
<artifactId>spring-boot-maven-plugin</artifactId>
58-
</plugin>
59-
</plugins>
60-
</build>
61-
62-
6326
</project>

eureka-server/pom.xml

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>com.coderqian</groupId>
76
<artifactId>eureka-server</artifactId>
87
<version>0.0.1-SNAPSHOT</version>
98
<packaging>jar</packaging>
@@ -12,31 +11,12 @@
1211
<description>Demo project for Spring Boot</description>
1312

1413
<parent>
15-
<groupId>org.springframework.boot</groupId>
16-
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.5.9.RELEASE</version>
18-
<relativePath/> <!-- lookup parent from repository -->
14+
<groupId>com.coderqian</groupId>
15+
<artifactId>spring-cloud-cli</artifactId>
16+
<version>1.0-SNAPSHOT</version>
1917
</parent>
2018

21-
<properties>
22-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23-
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24-
<java.version>1.8</java.version>
25-
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
26-
</properties>
27-
2819
<dependencies>
29-
<dependency>
30-
<groupId>org.springframework.boot</groupId>
31-
<artifactId>spring-boot-starter</artifactId>
32-
</dependency>
33-
34-
<dependency>
35-
<groupId>org.springframework.boot</groupId>
36-
<artifactId>spring-boot-starter-test</artifactId>
37-
<scope>test</scope>
38-
</dependency>
39-
4020
<!-- 引入Eureka服务包-->
4121
<dependency>
4222
<groupId>org.springframework.cloud</groupId>
@@ -47,30 +27,6 @@
4727
<groupId>org.springframework.cloud</groupId>
4828
<artifactId>spring-cloud-starter-config</artifactId>
4929
</dependency>
50-
51-
5230
</dependencies>
5331

54-
<dependencyManagement>
55-
<dependencies>
56-
<dependency>
57-
<groupId>org.springframework.cloud</groupId>
58-
<artifactId>spring-cloud-dependencies</artifactId>
59-
<version>${spring-cloud.version}</version>
60-
<type>pom</type>
61-
<scope>import</scope>
62-
</dependency>
63-
</dependencies>
64-
</dependencyManagement>
65-
66-
<build>
67-
<plugins>
68-
<plugin>
69-
<groupId>org.springframework.boot</groupId>
70-
<artifactId>spring-boot-maven-plugin</artifactId>
71-
</plugin>
72-
</plugins>
73-
</build>
74-
75-
7632
</project>

feign-server/pom.xml

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>com.coderqian</groupId>
76
<artifactId>feign-server</artifactId>
87
<version>0.0.1-SNAPSHOT</version>
98
<packaging>jar</packaging>
@@ -12,19 +11,11 @@
1211
<description>Demo project for Spring Boot</description>
1312

1413
<parent>
15-
<groupId>org.springframework.boot</groupId>
16-
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.5.9.RELEASE</version>
18-
<relativePath/> <!-- lookup parent from repository -->
14+
<groupId>com.coderqian</groupId>
15+
<artifactId>spring-cloud-cli</artifactId>
16+
<version>1.0-SNAPSHOT</version>
1917
</parent>
2018

21-
<properties>
22-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23-
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24-
<java.version>1.8</java.version>
25-
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
26-
</properties>
27-
2819
<dependencies>
2920
<!-- spring boot 2.0 -->
3021
<!--<dependency>-->
@@ -51,34 +42,6 @@
5142
<groupId>org.springframework.cloud</groupId>
5243
<artifactId>spring-cloud-starter-eureka</artifactId>
5344
</dependency>
54-
55-
<dependency>
56-
<groupId>org.springframework.boot</groupId>
57-
<artifactId>spring-boot-starter-test</artifactId>
58-
<scope>test</scope>
59-
</dependency>
6045
</dependencies>
6146

62-
<dependencyManagement>
63-
<dependencies>
64-
<dependency>
65-
<groupId>org.springframework.cloud</groupId>
66-
<artifactId>spring-cloud-dependencies</artifactId>
67-
<version>${spring-cloud.version}</version>
68-
<type>pom</type>
69-
<scope>import</scope>
70-
</dependency>
71-
</dependencies>
72-
</dependencyManagement>
73-
74-
<build>
75-
<plugins>
76-
<plugin>
77-
<groupId>org.springframework.boot</groupId>
78-
<artifactId>spring-boot-maven-plugin</artifactId>
79-
</plugin>
80-
</plugins>
81-
</build>
82-
83-
8447
</project>

feign-server/src/main/java/com/coderqian/feignserver/service/TestCustomerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* mail: qianlq0824@gmail.com
1414
*/
1515

16-
@FeignClient(value = "eureka-customer", fallback = HystrixClientFallback.class)
16+
@FeignClient(value = "service-customer", fallback = HystrixClientFallback.class)
1717
@Service
1818
public interface TestCustomerService {
1919

feign-server/src/main/java/com/coderqian/feignserver/service/TestOrderService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* mail: qianlq0824@gmail.com
1212
*/
1313

14-
@FeignClient(value = "eureka-order")
14+
@FeignClient(value = "service-order")
1515
public interface TestOrderService {
1616

1717
@RequestMapping(value = "/test/result", method = RequestMethod.GET)

feign-server/src/main/resources/application.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka
44

55
feign.hystrix.enabled=true
66

7-
#请求处理的超时时间
8-
#ribbon.ReadTimeout=120000
9-
#请求连接的超时时间
10-
#ribbon.ConnectTimeout=30000
7+
# 请求处理的超时时间
8+
# ribbon.ReadTimeout=120000
9+
# 请求连接的超时时间
10+
# ribbon.ConnectTimeout=30000

feign-server/src/test/java/com/coderqian/feignserver/FeginServerApplicationTests.java renamed to feign-server/src/test/java/com/coderqian/feignserver/FeignServerApplicationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
@RunWith(SpringRunner.class)
99
@SpringBootTest
10-
public class FeginServerApplicationTests {
10+
public class FeignServerApplicationTests {
1111

1212
@Test
1313
public void contextLoads() {

pom.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,53 @@
1818
<module>feign-server</module>
1919
<module>zipkin-server</module>
2020
</modules>
21+
22+
<parent>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-parent</artifactId>
25+
<version>1.5.9.RELEASE</version>
26+
<relativePath/> <!-- lookup parent from repository -->
27+
</parent>
28+
29+
<properties>
30+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
31+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
32+
<java.version>1.8</java.version>
33+
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
34+
</properties>
35+
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.springframework.boot</groupId>
39+
<artifactId>spring-boot-starter</artifactId>
40+
</dependency>
41+
42+
<dependency>
43+
<groupId>org.springframework.boot</groupId>
44+
<artifactId>spring-boot-starter-test</artifactId>
45+
<scope>test</scope>
46+
</dependency>
47+
</dependencies>
48+
49+
<dependencyManagement>
50+
<dependencies>
51+
<dependency>
52+
<groupId>org.springframework.cloud</groupId>
53+
<artifactId>spring-cloud-dependencies</artifactId>
54+
<version>${spring-cloud.version}</version>
55+
<type>pom</type>
56+
<scope>import</scope>
57+
</dependency>
58+
</dependencies>
59+
</dependencyManagement>
60+
61+
<build>
62+
<plugins>
63+
<plugin>
64+
<groupId>org.springframework.boot</groupId>
65+
<artifactId>spring-boot-maven-plugin</artifactId>
66+
</plugin>
67+
</plugins>
68+
</build>
69+
2170
</project>

0 commit comments

Comments
 (0)