Skip to content

Commit 5431d67

Browse files
committed
Initial commit
0 parents  commit 5431d67

File tree

198 files changed

+6854
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+6854
-0
lines changed

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Default ignored files
2+
.idea/**
3+
target/**
4+
*.iml
5+
6+
# Project exclude paths
7+
/cloud-alibaba-config-client3377/target/
8+
/cloud-alibaba-consumer-order83/target/
9+
/cloud-alibaba-consumer-order84/target/
10+
/cloud-alibaba-provider-payment9003/target/
11+
/cloud-alibaba-provider-payment9004/target/
12+
/cloud-alibaba-provider-payment9010/target/
13+
/cloud-alibaba-sentinel-8401/target/
14+
/cloud-common/target/
15+
/cloud-config-client4433/target/
16+
/cloud-config-client5566/target/
17+
/cloud-config-server3344/target/
18+
/cloud-consumer-hystrix-dashboard9002/target/
19+
/cloud-consumer-order80/target/
20+
/cloud-consumer-order-consul80/target/
21+
/cloud-consumer-order-openfeign80/target/
22+
/cloud-consumer-order-openfeign-hystrix80/target/
23+
/cloud-consumer-order-zk80/target/
24+
/cloud-eureka-server7001/target/
25+
/cloud-eureka-server7002/target/
26+
/cloud-gateway-gateway9527/target/
27+
/cloud-provider-payment8001/target/
28+
/cloud-provider-payment8002/target/
29+
/cloud-provider-payment-consul8006/target/
30+
/cloud-provider-payment-hystrix8001/target/
31+
/cloud-provider-payment-zk8004/target/
32+
/cloud-seata-account2003/target/
33+
/cloud-seata-order2001/target/
34+
/cloud-seata-storage2002/target/
35+
/cloud-stream-rabbitmq-consumer8802/target/
36+
/cloud-stream-rabbitmq-consumer8803/target/
37+
/cloud-stream-rabbitmq-provider8801/target/
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>cloud2021</artifactId>
7+
<groupId>com.jason.lee</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>cloud-alibaba-config-client3377</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>com.alibaba.cloud</groupId>
17+
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
18+
</dependency>
19+
<dependency>
20+
<groupId>com.alibaba.cloud</groupId>
21+
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.springframework.boot</groupId>
25+
<artifactId>spring-boot-starter-web</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.springframework.boot</groupId>
29+
<artifactId>spring-boot-starter-actuator</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-devtools</artifactId>
34+
<!--
35+
compile:默认值,表示当前依赖包要参与当前项目的编译,后续测试,运行时,打包
36+
provided:代表在编译和测试的时候用,运行,打包的时候不会打包进去
37+
test:表示当前依赖包只参与测试时的工作
38+
runtime:表示当前依赖包只参与运行周期
39+
-->
40+
<scope>runtime</scope>
41+
<!--依赖不传递-->
42+
<optional>true</optional>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.projectlombok</groupId>
46+
<artifactId>lombok</artifactId>
47+
<optional>true</optional>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.springframework.boot</groupId>
51+
<artifactId>spring-boot-starter-test</artifactId>
52+
<scope>test</scope>
53+
</dependency>
54+
<dependency>
55+
<groupId>com.jason.lee</groupId>
56+
<artifactId>cloud-common</artifactId>
57+
<version>1.0-SNAPSHOT</version>
58+
</dependency>
59+
</dependencies>
60+
61+
</project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.jason.lee;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6+
7+
/**
8+
* @author huanli9
9+
* @description
10+
* @date 2021/3/9 23:16
11+
*/
12+
@EnableDiscoveryClient
13+
@SpringBootApplication
14+
public class ConfigClientApplication3377 {
15+
public static void main(String[] args) {
16+
SpringApplication.run(ConfigClientApplication3377.class, args);
17+
}
18+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.jason.lee.controller;
2+
3+
import lombok.extern.slf4j.Slf4j;
4+
import org.springframework.beans.factory.annotation.Value;
5+
import org.springframework.cloud.context.config.annotation.RefreshScope;
6+
import org.springframework.web.bind.annotation.GetMapping;
7+
import org.springframework.web.bind.annotation.RestController;
8+
9+
/**
10+
* @author huanli9
11+
* @description
12+
* @date 2021/3/10 22:04
13+
*/
14+
@Slf4j
15+
@RefreshScope
16+
@RestController
17+
public class ConfigController {
18+
19+
@Value("${config.info}")
20+
private String configInfo;
21+
22+
@GetMapping("/get")
23+
public String getConfigInfo() {
24+
return configInfo;
25+
}
26+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
spring:
2+
profiles:
3+
# active: dev
4+
active: test
5+
6+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
server:
2+
port: 3377
3+
4+
spring:
5+
application:
6+
name: cloud-config-client
7+
cloud:
8+
nacos:
9+
discovery:
10+
server-addr: localhost:8848
11+
namespace: 2c10b987-55f3-427a-b9f9-cfdb5584f9be
12+
config:
13+
server-addr: localhost:8848
14+
file-extension: yaml
15+
namespace: 2c10b987-55f3-427a-b9f9-cfdb5584f9be
16+
group: TEST_GROUP
17+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>cloud2021</artifactId>
7+
<groupId>com.jason.lee</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>cloud-alibaba-consumer-order83</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>com.alibaba.cloud</groupId>
17+
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.springframework.boot</groupId>
21+
<artifactId>spring-boot-starter-web</artifactId>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.springframework.boot</groupId>
25+
<artifactId>spring-boot-starter-actuator</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.springframework.boot</groupId>
29+
<artifactId>spring-boot-devtools</artifactId>
30+
<!--
31+
compile:默认值,表示当前依赖包要参与当前项目的编译,后续测试,运行时,打包
32+
provided:代表在编译和测试的时候用,运行,打包的时候不会打包进去
33+
test:表示当前依赖包只参与测试时的工作
34+
runtime:表示当前依赖包只参与运行周期
35+
-->
36+
<scope>runtime</scope>
37+
<!--依赖不传递-->
38+
<optional>true</optional>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.projectlombok</groupId>
42+
<artifactId>lombok</artifactId>
43+
<optional>true</optional>
44+
</dependency>
45+
<dependency>
46+
<groupId>org.springframework.boot</groupId>
47+
<artifactId>spring-boot-starter-test</artifactId>
48+
<scope>test</scope>
49+
</dependency>
50+
<dependency>
51+
<groupId>com.jason.lee</groupId>
52+
<artifactId>cloud-common</artifactId>
53+
<version>1.0-SNAPSHOT</version>
54+
</dependency>
55+
</dependencies>
56+
57+
</project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.jason.lee;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6+
7+
/**
8+
* @author huanli9
9+
* @description
10+
* @date 2021/3/9 23:16
11+
*/
12+
@EnableDiscoveryClient
13+
@SpringBootApplication
14+
public class OrderApplication83 {
15+
public static void main(String[] args) {
16+
SpringApplication.run(OrderApplication83.class, args);
17+
}
18+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.jason.lee.config;
2+
3+
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
4+
import org.springframework.context.annotation.Bean;
5+
import org.springframework.context.annotation.Configuration;
6+
import org.springframework.web.client.RestTemplate;
7+
8+
/**
9+
* @author huanli9
10+
* @description
11+
* @date 2021/3/10 22:51
12+
*/
13+
@Configuration
14+
public class AppConfig {
15+
16+
@LoadBalanced //负载均衡
17+
@Bean
18+
public RestTemplate getRestTemplate() {
19+
return new RestTemplate();
20+
}
21+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.jason.lee.controller;
2+
3+
import com.jason.lee.dto.CommonResult;
4+
import com.jason.lee.entities.Payment;
5+
import lombok.extern.slf4j.Slf4j;
6+
import org.springframework.web.bind.annotation.GetMapping;
7+
import org.springframework.web.bind.annotation.PathVariable;
8+
import org.springframework.web.bind.annotation.PostMapping;
9+
import org.springframework.web.bind.annotation.RequestBody;
10+
import org.springframework.web.bind.annotation.RequestMapping;
11+
import org.springframework.web.bind.annotation.RestController;
12+
import org.springframework.web.client.RestTemplate;
13+
14+
import javax.annotation.Resource;
15+
16+
/**
17+
* @author huanli9
18+
* @description
19+
* @date 2021/3/10 22:04
20+
*/
21+
@Slf4j
22+
@RequestMapping("/order")
23+
@RestController
24+
public class OrderController {
25+
26+
@Resource
27+
private RestTemplate restTemplate;
28+
29+
public static final String PAYMENT_URL = "http://cloud-payment-service";
30+
31+
@PostMapping("/create")
32+
public CommonResult create(@RequestBody Payment payment) {
33+
return restTemplate.postForObject(PAYMENT_URL + "/payment/create", payment, CommonResult.class);
34+
}
35+
36+
@GetMapping("/get/{id}")
37+
public CommonResult getPaymentById(@PathVariable Long id) {
38+
return restTemplate.getForObject(PAYMENT_URL + "/payment/get/" + id, CommonResult.class);
39+
}
40+
41+
}

0 commit comments

Comments
 (0)