使用springboot每日推送早安問(wèn)候語(yǔ)到用戶微信的全過(guò)程
本文主要實(shí)現(xiàn)給不同的用戶推動(dòng)不同的問(wèn)候模板
準(zhǔn)備工作
申請(qǐng)微信公眾平臺(tái)的測(cè)試號(hào)
創(chuàng)建成功后,可以看到appid和appsecret,這個(gè)后面認(rèn)證時(shí)需要

申請(qǐng)模板
可自行修改
今天是:{{now.DATA}} 不管那一天,每一天都是想你的一天
當(dāng)前城市:{{city.DATA}}
今天的天氣:{{text.DATA}}
最低氣溫:{{low.DATA}} 度
最高氣溫:{{high.DATA}} 度
今天是我們想戀的第:{{scq_day.DATA}} 天
距你的生日還有:{{bir_day.DATA}} 天
{{daily_english_cn.DATA}}
{{daily_english_en.DATA}}
新建成功后,記得保存模板Id后續(xù)有用

掃描關(guān)注該測(cè)試公眾號(hào)
掃碼關(guān)注后,記錄微信號(hào),后續(xù)推送通知用

申請(qǐng)百度天氣
完成認(rèn)證后,創(chuàng)建一個(gè)應(yīng)用,保存ak

申請(qǐng)?zhí)煨袛?shù)據(jù)的接口
- 申請(qǐng)彩虹屁
- 申請(qǐng)每日一句
記得保存申請(qǐng)接口的key

開(kāi)發(fā)工作
技術(shù)棧
- springboot 2.7.5
- swagger 3.0
- mysql 8.x
- spring data jpa
- openfeign
依賴(lài)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.zhao</groupId>
<artifactId>daily-weather</artifactId>
<version>1.0.0</version>
<name>daily-weather</name>
<description>微信用戶推送消息</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.7.5</spring-boot.version>
<swagger.version>3.0.0</swagger.version>
<knife4j.version>3.0.3</knife4j.version>
<fastjson.version>2.0.15</fastjson.version>
<openfeign.version>3.1.3</openfeign.version>
<hutools.version>5.7.5</hutools.version>
</properties>
<dependencies>
<!--hutools-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>${hutools.version}</version>
</dependency>
<!--fastjson-->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!--open feign-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>${openfeign.version}</version>
</dependency>
<!--weixin-java-mp-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>3.3.0</version>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${swagger.version}</version>
</dependency>
<!--換掉默認(rèn)皮膚-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.7.RELEASE</version>
<configuration>
<mainClass>com.zhao.wechat.DailyWeatherApplication</mainClass>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>配置文件
server:
port: 43310
# 微信配置
tencent:
wechat:
appId: 微信appid
appSecret: 微信appSecret
# 模板消息集合
templatelist:
- type: 1
templateId: 微信模板id
- type: 2
templateId: 微信模板id
- type: 3
templateId: 微信模板id
# 百度天氣配置
baidu:
server: https://api.map.baidu.com
ak: 百度數(shù)據(jù)的ak
# 天行數(shù)據(jù)
tianxin:
server: http://api.tianapi.com
key: 天行數(shù)據(jù)的key
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://ip:3306/庫(kù)名?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: 564929
hikari:
minimum-idle: 5
# 空閑連接存活最大時(shí)間,默認(rèn)600000(10分鐘)
idle-timeout: 180000
# 連接池最大連接數(shù),默認(rèn)是10
maximum-pool-size: 10
# 此屬性控制從池返回的連接的默認(rèn)自動(dòng)提交行為,默認(rèn)值:true
auto-commit: true
# 連接池名稱(chēng)
pool-name: MyHikariCP
# 此屬性控制池中連接的最長(zhǎng)生命周期,值0表示無(wú)限生命周期,默認(rèn)1800000即30分鐘
max-lifetime: 1800000
# 數(shù)據(jù)庫(kù)連接超時(shí)時(shí)間,默認(rèn)30秒,即30000
connection-timeout: 30000
connection-test-query: SELECT 1
jpa:
show-sql: true # 默認(rèn)false,在日志里顯示執(zhí)行的sql語(yǔ)句
database: mysql
database-platform: org.hibernate.dialect.MySQL5Dialect
hibernate:
ddl-auto: update #指定為update,每次啟動(dòng)項(xiàng)目檢測(cè)表結(jié)構(gòu)有變化的時(shí)候會(huì)新增字段,表不存在時(shí)會(huì) 新建,如果指定create,則每次啟動(dòng)項(xiàng)目都會(huì)清空數(shù)據(jù)并刪除表,再新建
naming:
#指定jpa的自動(dòng)表生成策略,駝峰自動(dòng)映射為下劃線格式7
implicit-strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
#physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
# 日志
#logging:
# config: classpath:logback-spring-dev.xml
統(tǒng)一數(shù)據(jù)封裝
package com.zhao.wechat.advice;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zhao.wechat.common.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
/**
* 對(duì)前端響應(yīng)結(jié)果統(tǒng)一封裝
*/
@Slf4j
@RestControllerAdvice(basePackages = {"com.zhao.wechat.rest"})
public class ApiResponseAdvice implements ResponseBodyAdvice<Object> {
/**
* 打印統(tǒng)一請(qǐng)求響應(yīng)規(guī)范
*/
ApiResponseAdvice(){
log.info("啟動(dòng)請(qǐng)求統(tǒng)一響應(yīng)規(guī)范... ...");
}
/**
* 判斷是否需要對(duì)返回值進(jìn)行封裝
* @param returnType the return type
* @param converterType the selected converter type
* @return
*/
@Override
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
// 如果返回的結(jié)果是Result.class類(lèi)型就不用封裝
if (returnType.getParameterType().equals(Result.class)){
return false;
}
return true;
}
/**
* 對(duì)返回前端的值統(tǒng)一封裝
* @param body the body to be written
* @param returnType the return type of the controller method
* @param selectedContentType the content type selected through content negotiation
* @param selectedConverterType the converter type selected to write to the response
* @param request the current request
* @param response the current response
* @return
*/
@Override
public Object beforeBodyWrite(Object body,
MethodParameter returnType,
MediaType selectedContentType,
Class<? extends HttpMessageConverter<?>> selectedConverterType,
ServerHttpRequest request,
ServerHttpResponse response) {
if (returnType.getParameterType().equals(String.class)){
// 如果是String類(lèi)需要特殊處理
ObjectMapper objectMapper = new ObjectMapper();
try {
// 設(shè)置響應(yīng)數(shù)據(jù)格式為json
response.getHeaders().add("content-type","application/json;charset=UTF-8");
return objectMapper.writeValueAsString(Result.success(body));
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
return Result.success(body);
}
}工程結(jié)構(gòu)

用戶controller
package com.zhao.wechat.rest;
import com.zhao.wechat.domain.UserInfo;
import com.zhao.wechat.service.UserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 用戶信息管理視圖層
*/
@RestController
@RequestMapping("/userInfo")
@Api(tags = "用戶信息管理")
public class UserInfoRest {
@Autowired
private UserInfoService userInfoService;
/**
* 分頁(yè)獲取所有的用戶
* @return
*/
@ApiOperation(value = "分頁(yè)獲取所有的用戶")
@PostMapping("/queryPage")
public Page<UserInfo> queryUserPage(@PageableDefault Pageable pageable){
Page<UserInfo> userInfos = userInfoService.queryUserPage(pageable.getPageNumber(), pageable.getPageSize());
return userInfos;
}
/**
* 添加或者修改用戶
*/
@ApiOperation(value = "添加或者修改用戶")
@PostMapping("/saveOrUpdate")
public void saveOrUpdate(@RequestBody UserInfo userInfo){
userInfoService.saveOrUpdate(userInfo);
}
/**
* 刪除用戶
*/
@ApiOperation(value = "刪除用戶")
@DeleteMapping("/delete")
public void deleteUserById(@RequestParam("id") Long id){
userInfoService.deleteUserById(id);
}
}調(diào)用第三方接口
package com.zhao.wechat.remote;
import com.zhao.wechat.remote.param.TianXinParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
/**
* 第三方接口天行數(shù)據(jù)
*/
@FeignClient(value = "TianDataRemoteClient",url = "${tianxin.server}")
public interface TianDataRemoteClient {
/**
* 獲取彩虹屁
*/
@GetMapping(value = "/caihongpi/index",
consumes = {MediaType.APPLICATION_JSON_VALUE},
produces = {MediaType.APPLICATION_JSON_VALUE}
)
String queryRainbow(@SpringQueryMap TianXinParam tianXinParam);
/**
* 獲取優(yōu)美的句子
*/
@GetMapping(value = "/ensentence/index",
consumes = {MediaType.APPLICATION_JSON_VALUE},
produces = {MediaType.APPLICATION_JSON_VALUE}
)
String queryEnsentence(@SpringQueryMap TianXinParam tianXinParam);
}推送微信數(shù)據(jù)
package com.zhao.wechat.service;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.zhao.wechat.config.WechatConfig;
import com.zhao.wechat.config.WechatTemplate;
import com.zhao.wechat.config.WechatTemplateList;
import com.zhao.wechat.domain.*;
import com.zhao.wechat.remote.BaiduWeatherRemoteClient;
import com.zhao.wechat.remote.TianDataRemoteClient;
import com.zhao.wechat.remote.param.BaiduWeatherParam;
import com.zhao.wechat.remote.param.TianXinParam;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Slf4j
@Service
public class PushDailyWechatImpl implements PushDailyWechat{
@Autowired
private UserInfoService userInfoService;
@Autowired
private BaiduWeatherRemoteClient baiduWeatherRemoteClient;
@Autowired
private TianDataRemoteClient tianDataRemoteClient;
/** 微信配置類(lèi) **/
@Autowired
private WechatConfig wechatConfig;
/** 模板列表**/
@Autowired
private WechatTemplateList wechatTemplateList;
/** ak **/
@Value("${baidu.ak}")
private String ak;
/** key **/
@Value("${tianxin.key}")
private String key;
/**
* 給不同的用戶推送消息
*/
@Override
public void pushWechat() throws WxErrorException {
// 獲取用戶列表
List<UserInfo> userInfoList = userInfoService.listUserInfo();
if (!CollectionUtils.isEmpty(userInfoList)){
// 根據(jù)用戶的type類(lèi)型和模板type進(jìn)行匹配
for (UserInfo userInfo : userInfoList) {
for (WechatTemplate template : wechatTemplateList.getTemplatelist()) {
if (userInfo.getType().equals(template.getType())){
this.wechatData(userInfo.getWechatId(), template.getTemplateId(),userInfo);
}
}
}
}
}
/**
* 封裝微信數(shù)據(jù)
* @param wechatId
* @param templateId
*/
private void wechatData(String wechatId,String templateId,UserInfo userInfo) throws WxErrorException {
// 創(chuàng)建配置信息
WxMpInMemoryConfigStorage wxStorage = new WxMpInMemoryConfigStorage();
wxStorage.setAppId(wechatConfig.getAppId());
wxStorage.setSecret(wechatConfig.getAppSecret());
WxMpService wxMpService = new WxMpServiceImpl();
wxMpService.setWxMpConfigStorage(wxStorage);
// 創(chuàng)建模板信息
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(wechatId)
.templateId(templateId)
.build();
// 獲取天氣預(yù)報(bào)信息
BaiduWeatherParam baiduWeatherParam = BaiduWeatherParam.builder()
.district_id(userInfo.getDistrictId())
.data_type("all")
.ak(this.ak)
.build();
String queryWeather = baiduWeatherRemoteClient.queryWeather(baiduWeatherParam);
log.info("查詢的百度天氣信息為:{}",queryWeather);
BaiduNowWeather baiduNowWeather = ApiResponse.parseBaiduNowData(queryWeather, BaiduNowWeather.class);
List<BaiduForecastsWeather> baiduForecastsWeatherList = ApiResponse.parseBaiduForecastsData(queryWeather, BaiduForecastsWeather.class);
log.info("baiduNowWeather:{},baiduForecastsWeather:{}",baiduNowWeather,baiduForecastsWeatherList);
// 獲取彩虹屁
TianXinParam tianXinParam = TianXinParam.builder().key(this.key).build();
String queryRainbow = tianDataRemoteClient.queryRainbow(tianXinParam);
List<TianRainbow> rainbowList = ApiResponse.parseTianData(queryRainbow, TianRainbow.class);
// 獲取每日一句
String queryEnsentence = tianDataRemoteClient.queryEnsentence(tianXinParam);
List<TianEnsentence> tianEnsentenceList = ApiResponse.parseTianData(queryEnsentence, TianEnsentence.class);
// 封裝模板數(shù)據(jù)
templateMessage.addData(new WxMpTemplateData("now", this.pareDateNow(baiduForecastsWeatherList.get(0)),"#FFB6C1"));
templateMessage.addData(new WxMpTemplateData("city",userInfo.getCity(),"#B95EA6"));
templateMessage.addData(new WxMpTemplateData("text",baiduNowWeather.getText(),"#173177"));
templateMessage.addData(new WxMpTemplateData("high",baiduForecastsWeatherList.get(0).getHigh(),"#87cefa"));
templateMessage.addData(new WxMpTemplateData("low",baiduForecastsWeatherList.get(0).getLow(),"#FF6347"));
templateMessage.addData(new WxMpTemplateData("scq_day",this.calScqDate(userInfo),"#FF1493"));
templateMessage.addData(new WxMpTemplateData("bir_day",this.calBirData(userInfo),"#FF00FF" ));
templateMessage.addData(new WxMpTemplateData("daily_english_cn",rainbowList.get(0).getContent(),"#800080"));
templateMessage.addData(new WxMpTemplateData("daily_english_en",tianEnsentenceList.get(0).getEn(),"#FFA500"));
log.info("發(fā)送的消息為:{}", JSON.toJSONString(templateMessage));
wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
}
/**
* 計(jì)算想認(rèn)識(shí)/想戀日期
* @return
*/
private String calScqDate(UserInfo userInfo){
// 獲取第一次想認(rèn)識(shí)的時(shí)間
if (Objects.nonNull(userInfo)){
Date scqTime = userInfo.getScqTime();
// 計(jì)算時(shí)間差
long between = DateUtil.between(scqTime, DateUtil.date(), DateUnit.DAY);
return String.valueOf(between);
}
return "";
}
/**
* 計(jì)算生日
* @param userInfo
* @return
*/
private String calBirData(UserInfo userInfo){
// 獲取用戶的出生日期
if (Objects.nonNull(userInfo)){
Date birTime = userInfo.getBirTime();
// 今日日期
Calendar today = Calendar.getInstance();
// 出生日期
Calendar birthDay = Calendar.getInstance();
// 設(shè)置生日
birthDay.setTime(birTime);
// 修改為本年
int bir;
birthDay.set(Calendar.YEAR,today.get(Calendar.YEAR));
if (birthDay.get(Calendar.DAY_OF_YEAR) < today.get(Calendar.DAY_OF_YEAR)){
// 生日已經(jīng)過(guò)了,計(jì)算明年的
bir = today.getActualMaximum(Calendar.DAY_OF_YEAR) - today.get(Calendar.DAY_OF_YEAR);
bir += birthDay.get(Calendar.DAY_OF_YEAR);
} else {
// 生日還沒(méi)過(guò)
bir = birthDay.get(Calendar.DAY_OF_YEAR) - today.get(Calendar.DAY_OF_YEAR);
}
return String.valueOf(bir);
}
return "";
}
/**
* 拼接今日時(shí)間
* @return
*/
private String pareDateNow(BaiduForecastsWeather baiduForecastsWeather){
// 獲取當(dāng)前日期
String now = DateUtil.format(DateUtil.date(), DatePattern.CHINESE_DATE_PATTERN);
// 獲取星期幾
String week = baiduForecastsWeather.getWeek();
return now+" "+week;
}
}定時(shí)任務(wù)
package com.zhao.wechat.job;
import com.zhao.wechat.service.PushDailyWechat;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 推送消息到用戶定時(shí)任務(wù)
*/
@Component
public class PushWechatJob {
@Autowired
private PushDailyWechat pushDailyWechat;
/**
* 每天早上7點(diǎn)推送到微信
* @throws WxErrorException
*/
@Scheduled(cron = "0 30 7 1/1 * ? ")
void doJob() throws WxErrorException {
pushDailyWechat.pushWechat();
}
}效果

推送到微信

總結(jié)
到此這篇關(guān)于使用springboot每日推送早安問(wèn)候語(yǔ)到用戶微信的文章就介紹到這了,更多相關(guān)springboot每日推送早安問(wèn)候語(yǔ)到微信內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Spring Boot 2.5.0 重新設(shè)計(jì)的spring.sql.init 配置有啥用
前幾天Spring Boot 2.5.0發(fā)布了,其中提到了關(guān)于Datasource初始化機(jī)制的調(diào)整,有讀者私信想了解這方面做了什么調(diào)整。那么今天就要詳細(xì)說(shuō)說(shuō)這個(gè)重新設(shè)計(jì)的配置內(nèi)容,并結(jié)合實(shí)際情況說(shuō)說(shuō)我的理解和實(shí)踐建議2021-05-05
Spring Boot單元測(cè)試中使用mockito框架mock掉整個(gè)RedisTemplate的示例
今天小編就為大家分享一篇關(guān)于Spring Boot單元測(cè)試中使用mockito框架mock掉整個(gè)RedisTemplate的示例,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2018-12-12
Spring Cloud OAuth2 實(shí)現(xiàn)用戶認(rèn)證及單點(diǎn)登錄的示例代碼
這篇文章主要介紹了Spring Cloud OAuth2 實(shí)現(xiàn)用戶認(rèn)證及單點(diǎn)登錄的示例代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10
Java微信公眾平臺(tái)開(kāi)發(fā)(2) 微信服務(wù)器post消息體的接收
這篇文章主要為大家詳細(xì)介紹了Java微信公眾平臺(tái)開(kāi)發(fā)第二步,微信服務(wù)器post消息體的接收,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-04-04
在SpringBoot中,如何使用Netty實(shí)現(xiàn)遠(yuǎn)程調(diào)用方法總結(jié)
我們?cè)谶M(jìn)行網(wǎng)絡(luò)連接的時(shí)候,建立套接字連接是一個(gè)非常消耗性能的事情,特別是在分布式的情況下,用線程池去保持多個(gè)客戶端連接,是一種非常消耗線程的行為.那么我們?cè)撏ㄟ^(guò)什么技術(shù)去解決上述的問(wèn)題呢,那么就不得不提一個(gè)網(wǎng)絡(luò)連接的利器——Netty,需要的朋友可以參考下2021-06-06

