Skip to content

Commit b002bf4

Browse files
author
Vincent.Li
committed
update
1 parent 2696140 commit b002bf4

File tree

66 files changed

+1075
-96
lines changed

Some content is hidden

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

66 files changed

+1075
-96
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@
1818
10. springcloud-app-rabbitmq rabbitmq消息生产消费的实践
1919
* 10.1 springcloud-app-rabbitmq-producer rabbitmq消息生产
2020
* 10.2 springcloud-app-rabbitmq-consumer rabbitmq消息消费
21-
11. springcloud-app-feign-client feign调用实践(使用nacos做注册发现,和springcloud-app-api配合使用)
21+
11. springcloud-app-feign-client feign调用实践(使用nacos做注册发现,和springcloud-app-api配合使用)
22+
12. springcloud-app-rocketmq rocketmq消息生产消费的实践
23+
* 12.1 springcloud-app-rocketmq-producer rocketmq消息生产
24+
* 12.2 springcloud-app-rocketmq-consumer rocketmq消息消费

pom.xml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<parent>
88
<groupId>org.springframework.boot</groupId>
99
<artifactId>spring-boot-starter-parent</artifactId>
10-
<version>2.3.3.RELEASE</version>
10+
<version>2.1.15.RELEASE</version>
1111
<relativePath/> <!-- lookup parent from repository -->
1212
</parent>
1313

14-
<groupId>com.licq</groupId>
14+
<groupId>com.vincent</groupId>
1515
<artifactId>springcloud-app-parent</artifactId>
1616
<version>1.0-SNAPSHOT</version>
1717
<name>springcloud-app-parent</name>
@@ -25,8 +25,7 @@
2525
<java.version>1.8</java.version>
2626
<maven.compiler.source>1.8</maven.compiler.source>
2727
<maven.compiler.target>1.8</maven.compiler.target>
28-
<!--<spring-cloud.version>Greenwich.SR3</spring-cloud.version>-->
29-
<spring-cloud.version>Hoxton.SR8</spring-cloud.version>
28+
<spring-cloud.version>Greenwich.SR3</spring-cloud.version>
3029
<fastjson.version>1.2.68</fastjson.version>
3130
<apollo.version>1.5.1</apollo.version>
3231
<alibaba-cloud.version>2.1.1.RELEASE</alibaba-cloud.version>
@@ -47,6 +46,7 @@
4746
<spring-kafka.version>2.2.11.RELEASE</spring-kafka.version>
4847
<commons-lang3.version>3.1</commons-lang3.version>
4948
<gson.version>2.8.2</gson.version>
49+
<rocketmq-spring-boot-starter.version>2.1.1</rocketmq-spring-boot-starter.version>
5050
</properties>
5151
<dependencyManagement>
5252
<dependencies>
@@ -120,6 +120,14 @@
120120
<version>${jedis.version}</version>
121121
</dependency>
122122

123+
124+
<dependency>
125+
<groupId>org.apache.rocketmq</groupId>
126+
<artifactId>rocketmq-spring-boot-starter</artifactId>
127+
<version>${rocketmq-spring-boot-starter.version}</version>
128+
</dependency>
129+
130+
123131
</dependencies>
124132
</dependencyManagement>
125133

@@ -152,6 +160,8 @@
152160
<module>springcloud-app-feign-client</module>
153161
<module>springcloud-app-apollo</module>
154162
<module>springcloud-app-docker</module>
163+
<module>springcloud-app-rocketmq</module>
164+
<module>springcloud-app-config-bus-client</module>
155165
</modules>
156166

157167

springcloud-app-api/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<parent>
66
<artifactId>springcloud-app-parent</artifactId>
7-
<groupId>com.licq</groupId>
7+
<groupId>com.vincent</groupId>
88
<version>1.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
@@ -37,7 +37,7 @@
3737
</dependency>
3838

3939
<dependency>
40-
<groupId>com.licq</groupId>
40+
<groupId>com.vincent</groupId>
4141
<artifactId>springcloud-app-common</artifactId>
4242
<version>1.0-SNAPSHOT</version>
4343
</dependency>

springcloud-app-api/src/main/java/com/vincent/springcloud/app/api/controller/PingController.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import com.alibaba.fastjson.JSONObject;
44
import com.vincent.springcloud.app.common.constants.SystemConstants;
5+
import com.vincent.springcloud.app.common.vo.resp.Response;
6+
import lombok.extern.slf4j.Slf4j;
57
import org.springframework.beans.factory.annotation.Value;
68
import org.springframework.web.bind.annotation.*;
79

@@ -10,6 +12,7 @@
1012
* @Description 测试
1113
* @since 2020/6/29
1214
*/
15+
@Slf4j
1316
@RestController
1417
@RequestMapping(SystemConstants.APP_API)
1518
public class PingController {
@@ -21,18 +24,27 @@ public class PingController {
2124

2225
@ResponseBody
2326
@GetMapping("/ping")
24-
public JSONObject ping(){
27+
public Response<JSONObject> ping() {
28+
log.info("PingController.ping#serverPort:{}", serverPort);
2529
JSONObject jsonObject = new JSONObject();
2630
jsonObject.put("applicationName", applicationName);
2731
jsonObject.put("port", serverPort);
2832
jsonObject.put("message", "pong!");
29-
return jsonObject;
33+
return Response.buildSuccess(jsonObject);
3034
}
3135

3236
@ResponseBody
3337
@GetMapping("/hello")
34-
public JSONObject hello(@RequestParam("name") String name){
35-
return new JSONObject().fluentPut("hello", name);
38+
public Response hello(@RequestParam("name") String name) {
39+
log.info("PingController.hello#name:{}, serverPort:{}", name, serverPort);
40+
return Response.buildSuccess(new JSONObject().fluentPut("hello", name));
41+
}
42+
43+
@ResponseBody
44+
@GetMapping(value = "hello/{name}")
45+
private Response<JSONObject> sayHello(@PathVariable("name") String name) {
46+
log.info("PingController.sayHello#name:{}, serverPort:{}", name, serverPort);
47+
return Response.buildSuccess(new JSONObject().fluentPut("sayHello", name));
3648
}
3749

3850
}

springcloud-app-api/src/main/resources/application.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ spring:
77
cloud:
88
nacos:
99
discovery:
10-
server-addr: http://devops.youhoinfo.com:80
11-
namespace: 1b146843-219b-475e-8acb-b4adae63fd37
10+
#换成自己的nacos服务地址
11+
server-addr: http://127.0.0.1:8848
12+
#换成自己的namespace,也可以不设置,用默认的public
13+
namespace: be0d62b6-4e0a-46f1-89a2-9d5e0430b361

springcloud-app-apollo/README.md

100755100644
File mode changed.

springcloud-app-apollo/pom.xml

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<parent>
66
<artifactId>springcloud-app-parent</artifactId>
7-
<groupId>com.licq</groupId>
7+
<groupId>com.vincent</groupId>
88
<version>1.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>

springcloud-app-apollo/springcloud-app-apollo-redis/pom.xml

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<parent>
66
<artifactId>springcloud-app-apollo</artifactId>
7-
<groupId>com.licq</groupId>
7+
<groupId>com.vincent</groupId>
88
<version>1.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>

springcloud-app-apollo/springcloud-app-apollo-redis/src/main/java/com/vincent/app/apollo/redis/SpringAppApolloRedisApplication.java

100755100644
File mode changed.

springcloud-app-apollo/springcloud-app-apollo-redis/src/main/java/com/vincent/app/apollo/redis/config/LoggerConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener;
77
import org.slf4j.Logger;
88
import org.slf4j.LoggerFactory;
9-
import org.springframework.beans.factory.annotation.Autowired;
109
import org.springframework.boot.logging.LogLevel;
1110
import org.springframework.boot.logging.LoggingSystem;
1211
import org.springframework.context.annotation.Configuration;
1312

1413
import javax.annotation.PostConstruct;
14+
import javax.annotation.Resource;
1515
import java.util.Set;
1616

1717
/**
@@ -25,7 +25,7 @@ public class LoggerConfig {
2525
private static final Logger logger = LoggerFactory.getLogger(LoggerConfig.class);
2626
private static final String LOGGER_TAG = "logging.level.";
2727

28-
@Autowired
28+
@Resource
2929
private LoggingSystem loggingSystem;
3030

3131
@ApolloConfig

0 commit comments

Comments
 (0)