diff --git a/README.md b/README.md
index c5d94a1..ae7616d 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,8 @@
4.Webflux Spring异步编程,你将发现新大陆(代码已经部分上传,blog完善中...)
+5.[利用EasyExcel,两行代码开发一个和API结果一致的生成Excel功能](https://github.com/xiaour/EasyExport#readme)
+
## 代码部分
⭐️ SpringBootDemo
diff --git a/SpringBootDemo/com.tony.spring.boot.iml b/SpringBootDemo/com.tony.spring.boot.iml
deleted file mode 100644
index d5354ea..0000000
--- a/SpringBootDemo/com.tony.spring.boot.iml
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/SpringBootDemo/pom.xml b/SpringBootDemo/pom.xml
index 230a45e..3280d80 100644
--- a/SpringBootDemo/pom.xml
+++ b/SpringBootDemo/pom.xml
@@ -4,14 +4,20 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- com.tony
- com.xiaour.spring.boot
- 1.0-SNAPSHOT
+ com.github.xiaour
+ springbootv1
+ 0.0.1-SNAPSHOT
+ SpringBootDemo
+ Demo project for Spring Boot
+ jar
+
+
org.springframework.boot
spring-boot-starter-parent
1.5.2.RELEASE
+
@@ -93,13 +99,13 @@
com.alibaba
fastjson
- 1.2.31
+ 1.2.83
commons-io
commons-io
- 2.5
+ 2.7
@@ -116,7 +122,7 @@
org.apache.poi
poi
- 3.13
+ 4.1.1
org.apache.poi
diff --git a/SpringBootDemo/src/main/java/com/xiaour/spring/boot/config/MyBatisConfig.java b/SpringBootDemo/src/main/java/com/xiaour/spring/boot/config/MyBatisConfig.java
index 3e498a6..5b1f78d 100644
--- a/SpringBootDemo/src/main/java/com/xiaour/spring/boot/config/MyBatisConfig.java
+++ b/SpringBootDemo/src/main/java/com/xiaour/spring/boot/config/MyBatisConfig.java
@@ -7,6 +7,7 @@
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
/**
@@ -38,6 +39,8 @@ public DruidDataSource dataSource() {
public SqlSessionFactory sqlSessionFactory() throws Exception {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
sqlSessionFactoryBean.setDataSource(dataSource());
+ sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
+ .getResources(("classpath*:mapper/*.xml")));
return sqlSessionFactoryBean.getObject();
}
}
diff --git a/SpringBootDemoV2/pom.xml b/SpringBootDemoV2/pom.xml
index 62a7b2a..9c0856a 100644
--- a/SpringBootDemoV2/pom.xml
+++ b/SpringBootDemoV2/pom.xml
@@ -3,18 +3,18 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- SpringBootDemoV2
- SpringBootDemoV2
+ com.github.xiaour
+ springbootv2
0.0.1-SNAPSHOT
- jar
-
SpringBootDemoV2
Demo project for Spring Boot V2
+ jar
+
org.springframework.boot
spring-boot-starter-parent
- 2.0.0.RELEASE
+ 2.4.2
@@ -29,6 +29,7 @@
org.springframework.boot
spring-boot-starter-data-redis
+
org.springframework.boot
spring-boot-starter-web
@@ -43,7 +44,7 @@
org.apache.zookeeper
zookeeper
- 3.4.11
+ 3.7.2
@@ -56,7 +57,7 @@
com.google.code.gson
gson
- 2.8.2
+ 2.8.9
@@ -65,15 +66,10 @@
1.10
-
- dom4j
- dom4j
-
-
junit
junit
- 4.12
+ 4.13.1
diff --git a/SpringBootDemoV2/src/main/java/com/github/xiaour/Application.java b/SpringBootDemoV2/src/main/java/com/github/xiaour/Application.java
index c1e862e..caf30a9 100644
--- a/SpringBootDemoV2/src/main/java/com/github/xiaour/Application.java
+++ b/SpringBootDemoV2/src/main/java/com/github/xiaour/Application.java
@@ -10,7 +10,8 @@ public class Application {
public static void main(String[] args) {
- SpringApplication.run(Application.class, args);
+ //SpringApplication.run(Application.class, args);
+
}
diff --git a/SpringBootDemoV2/src/main/java/com/github/xiaour/controller/AuthNotify.java b/SpringBootDemoV2/src/main/java/com/github/xiaour/controller/AuthNotify.java
deleted file mode 100644
index 11dfee9..0000000
--- a/SpringBootDemoV2/src/main/java/com/github/xiaour/controller/AuthNotify.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package com.github.xiaour.controller;
-
-import com.github.xiaour.constants.Api;
-import com.github.xiaour.exception.OApiException;
-import com.github.xiaour.utils.HttpHelper;
-import com.github.xiaour.utils.JsonUtil;
-import com.github.xiaour.utils.WXBizMsgCrypt;
-import com.github.xiaour.utils.Xml2JsonUtil;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import jdk.nashorn.internal.parser.JSONParser;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 授权事件接收
- * @Author: Xiaour
- * @Description:
- * @Date: 2018/3/12 下午5:27
- */
-@RestController
-public class AuthNotify {
-
-
- /**
- * 这里以后肯定要维护到配置文件或缓存的
- * @param requestBody
- * @return
- */
-
- private static String aesKey="4a5665bf9fbe0618b7154cc9d93342b6a7b2abcf4e8";
-
- private static String token="ois3rd";
-
- private static String appsecret="a38dd974a9e6490dfbf5b21cd38f9996";
-
- private static String component_access_token="";
-
-
- @RequestMapping("auth_notify")
- @PostMapping(produces = "application/xml; charset=UTF-8")
- public String payNotify(@RequestBody String requestBody, @RequestParam("timestamp")String timestamp, @RequestParam("nonce")String nonce,
- @RequestParam("msg_signature")String msgSignature){
- String appid=null;
- Map data= new HashMap<>();
- data.put("timestamp",timestamp);
- data.put("nonce",nonce);
- data.put("msg_signature",msgSignature);
- data.put("requestBody",requestBody);
-
- System.out.println(data);
-
- try {
- JsonObject jsonData= Xml2JsonUtil.xml2Json(requestBody);
-
- appid=jsonData.get("AppId").getAsString();
-
- WXBizMsgCrypt pc = new WXBizMsgCrypt(token, aesKey,appid);
-
- String decode=pc.decryptMsg(msgSignature,timestamp,nonce,jsonData.get("Encrypt").getAsString());
-
- System.out.println(decode);
-
- JsonObject decodeJson=Xml2JsonUtil.xml2Json(decode);
-
- getComponentTtoken(appid,appsecret,decodeJson.get("ComponentVerifyTicket").getAsString());
-
- getPreAuthCode(appid);
-
- } catch (Exception e) {
-
- e.printStackTrace();
-
- }
- return "success";
- }
-
- private String getPreAuthCode(String appid) {
- String preAuthCode=null;
-
- Map postData=new HashMap<>();
-
- postData.put("component_appid",appid);
- try {
-
- String jsonStr= HttpHelper.postByRest(Api.create_preauthcode+component_access_token,String.class,null, JsonUtil.getJsonString(postData));
- Map jsonMap= JsonUtil.json2Obj(jsonStr,Map.class);
-
- preAuthCode=jsonMap.get("pre_auth_code").toString();
-
- String guideUrl="https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid="+appid+"&pre_auth_code="+preAuthCode+"&redirect_uri=http://sp.chifaner.com/wx/callback/auth";
-
- System.out.println(guideUrl);
-
- return preAuthCode;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private void getComponentTtoken(String appid, String appsecret, String componentVerifyTicket){
-
- Map postData=new HashMap<>();
-
- postData.put("component_appid",appid);
-
- postData.put("component_appsecret",appsecret);
-
- postData.put("component_verify_ticket",componentVerifyTicket);
-
- try {
-
- String jsonStr= HttpHelper.postByRest(Api.component_token,String.class,null, JsonUtil.getJsonString(postData));
- Map jsonMap= JsonUtil.json2Obj(jsonStr,Map.class);
- component_access_token=jsonMap.get("component_access_token").toString();
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public static void main(String[] args) {
- String xml="" + "\n" +
- "\n" + "";
- try {
- JsonObject jsonData= Xml2JsonUtil.xml2Json(xml);
-
- WXBizMsgCrypt pc = null;
-
- pc = new WXBizMsgCrypt(token, aesKey,"wxa797588149020de4");
-
- System.out.println(jsonData.get("Encrypt").getAsString());
-
- String decode=pc.decryptMsg("d5b4bcef832c27f6f2804d0055cec64864c82a54","1520922592","941622427",jsonData.get("Encrypt").getAsString());
-
- JsonObject decodeJson=Xml2JsonUtil.xml2Json(decode);
-
- System.out.println(decodeJson.get("ComponentVerifyTicket").getAsString());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/SpringBootDemoV2/src/main/java/com/github/xiaour/controller/WxCallback.java b/SpringBootDemoV2/src/main/java/com/github/xiaour/controller/WxCallback.java
deleted file mode 100644
index 98085fa..0000000
--- a/SpringBootDemoV2/src/main/java/com/github/xiaour/controller/WxCallback.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.github.xiaour.controller;
-
-import com.github.xiaour.utils.Xml2JsonUtil;
-import com.google.gson.JsonObject;
-import org.dom4j.DocumentException;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 消息与事件接收
- * @Author: Xiaour
- * @Description:
- * @Date: 2018/3/12 下午5:25
- */
-
-@RestController
-public class WxCallback {
-
- @RequestMapping("callback/auth")
- public String callbackAuth(String auth_code,Integer expires_in){
- System.out.println("auth_code:"+auth_code);
- System.out.println("expires_in:"+expires_in);
- return "success";
- }
-
-
- @RequestMapping("callback/{appid}")
- @PostMapping(produces = "application/xml; charset=UTF-8")
- public String callbackMsg(@RequestBody String requestBody, @PathVariable String appid){
- System.out.println(appid);
- System.out.println(requestBody);
- try {
- JsonObject jsonData= Xml2JsonUtil.xml2Json(requestBody);
- System.out.println(jsonData);
- } catch (DocumentException e) {
- e.printStackTrace();
- }
- return "success";
- }
-
-
-}
diff --git a/SpringBootDemoV3/.gitignore b/SpringBootDemoV3/.gitignore
new file mode 100644
index 0000000..549e00a
--- /dev/null
+++ b/SpringBootDemoV3/.gitignore
@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git a/SpringBootDemoV3/pom.xml b/SpringBootDemoV3/pom.xml
new file mode 100644
index 0000000..110db5f
--- /dev/null
+++ b/SpringBootDemoV3/pom.xml
@@ -0,0 +1,64 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.2.3
+
+
+
+ com.github.xiaour
+ springbootv3
+ 0.0.1-SNAPSHOT
+ SpringBootDemoV3
+ Demo project for Spring Boot
+ jar
+
+
+ 17
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ io.github.xiaour
+ easy-export
+ 1.0.1-RELEASE
+
+
+
+ com.alibaba
+ easyexcel
+ 2.2.3
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/SpringBootDemoV3Application.java b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/SpringBootDemoV3Application.java
new file mode 100644
index 0000000..7b98f02
--- /dev/null
+++ b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/SpringBootDemoV3Application.java
@@ -0,0 +1,15 @@
+package com.xiaour.spring.boot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SpringBootDemoV3Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringBootDemoV3Application.class, args);
+ //System.out.println(Math.max(10,11));
+ }
+
+
+}
diff --git a/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/controller/CatController.java b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/controller/CatController.java
new file mode 100644
index 0000000..d740815
--- /dev/null
+++ b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/controller/CatController.java
@@ -0,0 +1,34 @@
+package com.xiaour.spring.boot.controller;
+
+import com.xiaour.spring.boot.entity.PageIndex;
+import com.xiaour.spring.boot.entity.PageInfo;
+import com.xiaour.spring.boot.service.CatService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/cat")
+public class CatController {
+
+ private CatService catService;
+
+ @Autowired
+ public CatController(CatService catService) {
+ this.catService = catService;
+ }
+
+ @GetMapping("list")
+ public PageInfo getCatList() {
+ PageIndex index = new PageIndex();
+ index.setPageIndex(1);
+ index.setPageSize(30);
+ return catService.getCatList(index);
+ }
+
+
+
+
+
+}
diff --git a/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/entity/Cat.java b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/entity/Cat.java
new file mode 100644
index 0000000..5aef16e
--- /dev/null
+++ b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/entity/Cat.java
@@ -0,0 +1,60 @@
+package com.xiaour.spring.boot.entity;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+
+public class Cat {
+
+ /**
+ * 宠物昵称
+ */
+ @ExcelProperty(value = "昵称")
+ private String nickName;
+
+ /**
+ * 年龄
+ */
+ @ExcelProperty(value = "年龄")
+ private Integer age;
+
+ /**
+ * 品种
+ */
+ @ExcelProperty(value = "品种")
+ private String category;
+
+ public Cat() {
+ }
+
+ public Cat(String nickName, Integer age, String category) {
+ this.nickName = nickName;
+ this.age = age;
+ this.category = category;
+ }
+
+ public String getNickName() {
+ return nickName;
+ }
+
+ public Cat setNickName(String nickName) {
+ this.nickName = nickName;
+ return this;
+ }
+
+ public Integer getAge() {
+ return age;
+ }
+
+ public Cat setAge(Integer age) {
+ this.age = age;
+ return this;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public Cat setCategory(String category) {
+ this.category = category;
+ return this;
+ }
+}
diff --git a/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/entity/PageIndex.java b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/entity/PageIndex.java
new file mode 100644
index 0000000..abaf3dc
--- /dev/null
+++ b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/entity/PageIndex.java
@@ -0,0 +1,24 @@
+package com.xiaour.spring.boot.entity;
+
+public class PageIndex {
+
+ private Integer pageIndex;
+
+ private Integer pageSize;
+
+ public Integer getPageIndex() {
+ return pageIndex;
+ }
+
+ public void setPageIndex(Integer pageIndex) {
+ this.pageIndex = pageIndex;
+ }
+
+ public Integer getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ }
+}
diff --git a/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/entity/PageInfo.java b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/entity/PageInfo.java
new file mode 100644
index 0000000..53fafdd
--- /dev/null
+++ b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/entity/PageInfo.java
@@ -0,0 +1,26 @@
+package com.xiaour.spring.boot.entity;
+
+import java.util.List;
+
+public class PageInfo {
+
+ private List> list;
+
+ private Integer total;
+
+ public List> getList() {
+ return list;
+ }
+
+ public void setList(List> list) {
+ this.list = list;
+ }
+
+ public Integer getTotal() {
+ return total;
+ }
+
+ public void setTotal(Integer total) {
+ this.total = total;
+ }
+}
diff --git a/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/service/CatService.java b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/service/CatService.java
new file mode 100644
index 0000000..ba1b8c1
--- /dev/null
+++ b/SpringBootDemoV3/src/main/java/com/xiaour/spring/boot/service/CatService.java
@@ -0,0 +1,44 @@
+package com.xiaour.spring.boot.service;
+
+import com.github.xiaour.easyexport.annotation.EasyExport;
+import com.github.xiaour.easyexport.annotation.EasyExportSingle;
+import com.xiaour.spring.boot.entity.Cat;
+import com.xiaour.spring.boot.entity.PageIndex;
+import com.xiaour.spring.boot.entity.PageInfo;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@EasyExport
+@Service
+public class CatService {
+
+ /**
+ * 这里主要是模拟数据和分页参数的一些主要逻辑
+ * @param pageIndex 模拟的分页参数,这里面是伪代码,无需实现
+ * @return
+ */
+ @EasyExportSingle(value = "小猫明细",modelClass = Cat.class)
+ public PageInfo getCatList(PageIndex pageIndex){
+
+ PageInfo page = new PageInfo();
+
+ List list = new ArrayList<>();
+
+ //下面提供了两种实体赋值方式,大家可以试试那种更方便
+ Cat cat1 = new Cat("咪咪",1,"波斯猫");
+
+ Cat cat2 = new Cat().setNickName("汤姆").setAge(6).setCategory("金渐层");
+
+ list.add(cat1);
+
+ list.add(cat2);
+
+ page.setList(list);
+
+ page.setTotal(list.size());
+
+ return page;
+ }
+}
diff --git a/SpringBootDemoV3/src/main/resources/application.properties b/SpringBootDemoV3/src/main/resources/application.properties
new file mode 100644
index 0000000..a39567d
--- /dev/null
+++ b/SpringBootDemoV3/src/main/resources/application.properties
@@ -0,0 +1,15 @@
+server.servlet.context-path= /demo3
+
+#??easyexport
+easyexport.enabled=true
+#??????
+#??????????
+easyexport.fetch.page.size=5000
+#???????????????????true???????
+easyexport.file.delete=true
+#???????????????????Sheet????sheet???150000
+easyexport.file.sheet.size=15000
+#????
+easyexport.field.page.number=pageIndex
+#???????
+easyexport.field.page.size=pageSize
\ No newline at end of file
diff --git a/SpringBootDemoV3/src/test/java/com/xiaour/spring/boot/SpringBootDemoV3ApplicationTests.java b/SpringBootDemoV3/src/test/java/com/xiaour/spring/boot/SpringBootDemoV3ApplicationTests.java
new file mode 100644
index 0000000..bbe9d67
--- /dev/null
+++ b/SpringBootDemoV3/src/test/java/com/xiaour/spring/boot/SpringBootDemoV3ApplicationTests.java
@@ -0,0 +1,13 @@
+package com.xiaour.spring.boot;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class SpringBootDemoV3ApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/SpringBootKafkaDemo/pom.xml b/SpringBootKafkaDemo/pom.xml
index 9681f7a..b0eb7a0 100644
--- a/SpringBootKafkaDemo/pom.xml
+++ b/SpringBootKafkaDemo/pom.xml
@@ -3,8 +3,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- com.xiaour.spring.boot
- kafka
+ com.github.xiaour
+ KafkaDemo
0.0.1-SNAPSHOT
jar
@@ -43,17 +43,17 @@
com.google.code.gson
gson
- 2.8.2
+ 2.8.9
org.springframework.boot
spring-boot-starter-web
- RELEASE
+ 2.5.12
org.springframework
spring-context
- 5.1.3.RELEASE
+ 5.2.22.RELEASE
diff --git a/SpringBootKafkaDemo/target/classes/application.yml b/SpringBootKafkaDemo/target/classes/application.yml
deleted file mode 100644
index 0b19627..0000000
--- a/SpringBootKafkaDemo/target/classes/application.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-server:
- servlet:
- context-path: /
- port: 8080
-spring:
- kafka:
- bootstrap-servers: 127.0.0.1:9092
- #生产者的配置,大部分我们可以使用默认的,这里列出几个比较重要的属性
- producer:
- #每批次发送消息的数量
- batch-size: 16
- #设置大于0的值将使客户端重新发送任何数据,一旦这些数据发送失败。注意,这些重试与客户端接收到发送错误时的重试没有什么不同。允许重试将潜在的改变数据的顺序,如果这两个消息记录都是发送到同一个partition,则第一个消息失败第二个发送成功,则第二条消息会比第一条消息出现要早。
- retries: 0
- #producer可以用来缓存数据的内存大小。如果数据产生速度大于向broker发送的速度,producer会阻塞或者抛出异常,以“block.on.buffer.full”来表明。这项设置将和producer能够使用的总内存相关,但并不是一个硬性的限制,因为不是producer使用的所有内存都是用于缓存。一些额外的内存会用于压缩(如果引入压缩机制),同样还有一些用于维护请求。
- buffer-memory: 33554432
- #key序列化方式
- key-serializer: org.apache.kafka.common.serialization.StringSerializer
- value-serializer: org.apache.kafka.common.serialization.StringSerializer
- #消费者的配置
- consumer:
- #Kafka中没有初始偏移或如果当前偏移在服务器上不再存在时,默认区最新 ,有三个选项 【latest, earliest, none】
- auto-offset-reset: latest
- #是否开启自动提交
- enable-auto-commit: true
- #自动提交的时间间隔
- auto-commit-interval: 100
- #key的解码方式
- key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
- #value的解码方式
- value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
- #在/usr/local/etc/kafka/consumer.properties中有配置
- group-id: test-consumer-group
-
diff --git a/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/KafkaApplication.class b/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/KafkaApplication.class
deleted file mode 100644
index 39bc9dc..0000000
Binary files a/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/KafkaApplication.class and /dev/null differ
diff --git a/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/consumer/Consumer.class b/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/consumer/Consumer.class
deleted file mode 100644
index a8d2073..0000000
Binary files a/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/consumer/Consumer.class and /dev/null differ
diff --git a/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/producer/Producer.class b/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/producer/Producer.class
deleted file mode 100644
index e9d87c3..0000000
Binary files a/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/producer/Producer.class and /dev/null differ
diff --git a/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/producer/SendController.class b/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/producer/SendController.class
deleted file mode 100644
index a532e7e..0000000
Binary files a/SpringBootKafkaDemo/target/classes/com/xiaour/spring/boot/kafka/producer/SendController.class and /dev/null differ
diff --git a/SpringBootKafkaDemo/target/test-classes/com/xiaour/spring/boot/kafka/KafkaApplicationTests.class b/SpringBootKafkaDemo/target/test-classes/com/xiaour/spring/boot/kafka/KafkaApplicationTests.class
deleted file mode 100644
index 3c908bf..0000000
Binary files a/SpringBootKafkaDemo/target/test-classes/com/xiaour/spring/boot/kafka/KafkaApplicationTests.class and /dev/null differ
diff --git a/SpringBootRocketMqDemo/pom.xml b/SpringBootRocketMqDemo/pom.xml
index e8cee00..d02e456 100644
--- a/SpringBootRocketMqDemo/pom.xml
+++ b/SpringBootRocketMqDemo/pom.xml
@@ -3,13 +3,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- com.xiaour.spring.boot
- rocketmq
+ com.github.xiaour
+ rocketmqDemo
0.0.1-SNAPSHOT
- jar
-
SpringBootRocketmqDemo
- Demo project for Spring Boot
+ Demo project for RocketMQ
+ jar
org.springframework.boot
@@ -45,7 +44,7 @@
org.springframework.boot
spring-boot-starter-web
- RELEASE
+ 2.5.12
diff --git a/SpringWebFluxDemo/pom.xml b/SpringWebFluxDemo/pom.xml
index a1aa877..f98a09c 100644
--- a/SpringWebFluxDemo/pom.xml
+++ b/SpringWebFluxDemo/pom.xml
@@ -9,10 +9,10 @@
com.github.xiaour
- flux
+ fluxDemo
0.0.1-SNAPSHOT
SpringWebFluxDemo
- Demo project for Spring Boot
+ Demo project for Web Flux
1.8
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..028c717
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,27 @@
+
+
+ 4.0.0
+
+ com.github.xiaour
+ com.xiaour.spring.boot
+ 0.0.1-SNAPSHOT
+ SpringBootDemo
+ SpringBoot set demo
+ pom
+
+
+ SpringBootDemo
+ SpringBootDemoV2
+ SpringBootDemoV3
+ SpringBootKafkaDemo
+ SpringBootRocketMqDemo
+ SpringWebFluxDemo
+
+
+
+
+ 17
+
+
+