spring cloud seata集成
目录
一、seata使用场景
二、seata组成
三、seata服务端搭建
四、客户端使用seata
4.1 客户端增加undo_log表
4.2 客户端增加seata相关配置
4.3 客户端使用注解
五、测试
一、seata使用场景
微服务中,一个业务涉及到多个微服务系统,每个微服务系统连接不同的数据库,要求数据一致性时使用。如下订单操作,调用下订单方法后,需要增加订单记录、减少产品库存;订单记录和产品库存 调用不同的微服务 数据存储在不同的数据库中;
调用下订单方法时,订单服务或库存服务任何一个出现问题,此方法执行失败,数据库记录需回滚。
理论支持:cap、base;
理论依据:二阶段提交法(准备、执行);三阶段提交法(询问、准备、执行);消息最终一致性;最大努力通知法;
解决方案:tcc(try-confirm-cancel)、sega、X/A等。
二、seata组成
seata是spring cloud生态中的分布式事务解决方案,包括seata服务端和客户端;
seata服务端是独立部署的;(seata担当事务协调器角色)
seata客户端,即每个微服务增加相关依赖和配置,使用@GlobalTransactional(rollbackFor = Exception.class)注解即可;
三、seata服务端搭建
1. 下载seata服务端包;
本文使用的是seata1.7.0版本的包。
2. 修改seata配置文件 application.yml,使用nacos注册seata服务,管理seata服务配置;
路径seata>conf,application.yml
# Copyright 1999-2019 Seata.io Group.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.server:port: 7091spring:application:name: seata-serverlogging:config: classpath:logback-spring.xmlfile:path: ${user.home}/logs/seataextend:logstash-appender:destination: 127.0.0.1:4560kafka-appender:bootstrap-servers: 127.0.0.1:9092topic: logback_to_logstash
console:user:username: seatapassword: seataseata:config:# support: nacos 、 consul 、 apollo 、 zk 、 etcd3type: nacosnacos:server-addr: 127.0.0.1:8948namespace:group: SEATA_GROUPusername: nacospassword: context-path:##if use MSE Nacos with auth, mutex with username/password attribute#access-key:#secret-key:data-id: seataServer.propertiesregistry:# support: nacos 、 eureka 、 redis 、 zk 、 consul 、 etcd3 、 sofatype: nacosnacos:application: seata-serverserver-addr: 127.0.0.1:8948group: SEATA_GROUPnamespace:cluster: defaultusername: nacospassword: context-path:##if use MSE Nacos with auth, mutex with username/password attribute#access-key:#secret-key:security:secretKey: tokenValidityInMilliseconds: 1800000ignore:urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login
在nacos中增加seata配置:
seataServer.properties配置文件:
#For details about configuration items, see https://seata.io/zh-cn/docs/user/configurations.html
#Transport configuration, for client and server
transport.type=TCP
transport.server=NIO
transport.heartbeat=true
transport.enableTmClientBatchSendRequest=false
transport.enableRmClientBatchSendRequest=true
transport.enableTcServerBatchSendResponse=false
transport.rpcRmRequestTimeout=30000
transport.rpcTmRequestTimeout=30000
transport.rpcTcRequestTimeout=30000
transport.threadFactory.bossThreadPrefix=NettyBoss
transport.threadFactory.workerThreadPrefix=NettyServerNIOWorker
transport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandler
transport.threadFactory.shareBossWorker=false
transport.threadFactory.clientSelectorThreadPrefix=NettyClientSelector
transport.threadFactory.clientSelectorThreadSize=1
transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThread
transport.threadFactory.bossThreadSize=1
transport.threadFactory.workerThreadSize=default
transport.shutdown.wait=3
transport.serialization=seata
transport.compressor=none#Transaction routing rules configuration, only for the client
service.vgroupMapping.default_tx_group=default
#If you use a registry, you can ignore it
service.default.grouplist=127.0.0.1:8091
service.enableDegrade=false
service.disableGlobalTransaction=false#Transaction rule configuration, only for the client
client.rm.asyncCommitBufferLimit=10000
client.rm.lock.retryInterval=10
client.rm.lock.retryTimes=30
client.rm.lock.retryPolicyBranchRollbackOnConflict=true
client.rm.reportRetryCount=5
client.rm.tableMetaCheckEnable=true
client.rm.tableMetaCheckerInterval=60000
client.rm.sqlParserType=druid
client.rm.reportSuccessEnable=false
client.rm.sagaBranchRegisterEnable=false
client.rm.sagaJsonParser=fastjson
client.rm.tccActionInterceptorOrder=-2147482648
client.tm.commitRetryCount=5
client.tm.rollbackRetryCount=5
client.tm.defaultGlobalTransactionTimeout=60000
client.tm.degradeCheck=false
client.tm.degradeCheckAllowTimes=10
client.tm.degradeCheckPeriod=2000
client.tm.interceptorOrder=-2147482648
client.undo.dataValidation=true
client.undo.logSerialization=jackson
client.undo.onlyCareUpdateColumns=true
server.undo.logSaveDays=7
server.undo.logDeletePeriod=86400000
client.undo.logTable=undo_log
client.undo.compress.enable=true
client.undo.compress.type=zip
client.undo.compress.threshold=64k
#For TCC transaction mode
tcc.fence.logTableName=tcc_fence_log
tcc.fence.cleanPeriod=1h#Log rule configuration, for client and server
log.exceptionRate=100#Transaction storage configuration, only for the server. The file, db, and redis configuration values are optional.
store.mode=db
store.lock.mode=db
store.session.mode=db
#Used for password encryption
store.publicKey=#These configurations are required if the `store mode` is `db`. If `store.mode,store.lock.mode,store.session.mode` are not equal to `db`, you can remove the configuration block.
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.cj.jdbc.Driver
store.db.url=jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true
store.db.user=root
store.db.password=
store.db.minConn=5
store.db.maxConn=30
store.db.globalTable=global_table
store.db.branchTable=branch_table
store.db.distributedLockTable=distributed_lock
store.db.queryLimit=100
store.db.lockTable=lock_table
store.db.maxWait=5000#Transaction rule configuration, only for the server
server.recovery.committingRetryPeriod=1000
server.recovery.asynCommittingRetryPeriod=1000
server.recovery.rollbackingRetryPeriod=1000
server.recovery.timeoutRetryPeriod=1000
server.maxCommitRetryTimeout=-1
server.maxRollbackRetryTimeout=-1
server.rollbackRetryTimeoutUnlockEnable=false
server.distributedLockExpireTime=10000
server.xaerNotaRetryTimeout=60000
server.session.branchAsyncQueueSize=5000
server.session.enableBranchAsyncRemove=false
server.enableParallelRequestHandle=false#Metrics configuration, only for the server
metrics.enabled=false
metrics.registryType=compact
metrics.exporterList=prometheus
metrics.exporterPrometheusPort=9898
3. 创建seata服务所需数据库表;
在seata script目录下找到sql脚本
执行sql语句建表:
-- -------------------------------- The script used when storeMode is 'db' --------------------------------
-- the table to store GlobalSession data
CREATE TABLE IF NOT EXISTS `global_table`
(`xid` VARCHAR(128) NOT NULL,`transaction_id` BIGINT,`status` TINYINT NOT NULL,`application_id` VARCHAR(32),`transaction_service_group` VARCHAR(32),`transaction_name` VARCHAR(128),`timeout` INT,`begin_time` BIGINT,`application_data` VARCHAR(2000),`gmt_create` DATETIME,`gmt_modified` DATETIME,PRIMARY KEY (`xid`),KEY `idx_status_gmt_modified` (`status` , `gmt_modified`),KEY `idx_transaction_id` (`transaction_id`)
) ENGINE = InnoDBDEFAULT CHARSET = utf8mb4;-- the table to store BranchSession data
CREATE TABLE IF NOT EXISTS `branch_table`
(`branch_id` BIGINT NOT NULL,`xid` VARCHAR(128) NOT NULL,`transaction_id` BIGINT,`resource_group_id` VARCHAR(32),`resource_id` VARCHAR(256),`branch_type` VARCHAR(8),`status` TINYINT,`client_id` VARCHAR(64),`application_data` VARCHAR(2000),`gmt_create` DATETIME(6),`gmt_modified` DATETIME(6),PRIMARY KEY (`branch_id`),KEY `idx_xid` (`xid`)
) ENGINE = InnoDBDEFAULT CHARSET = utf8mb4;-- the table to store lock data
CREATE TABLE IF NOT EXISTS `lock_table`
(`row_key` VARCHAR(128) NOT NULL,`xid` VARCHAR(128),`transaction_id` BIGINT,`branch_id` BIGINT NOT NULL,`resource_id` VARCHAR(256),`table_name` VARCHAR(32),`pk` VARCHAR(36),`status` TINYINT NOT NULL DEFAULT '0' COMMENT '0:locked ,1:rollbacking',`gmt_create` DATETIME,`gmt_modified` DATETIME,PRIMARY KEY (`row_key`),KEY `idx_status` (`status`),KEY `idx_branch_id` (`branch_id`),KEY `idx_xid` (`xid`)
) ENGINE = InnoDBDEFAULT CHARSET = utf8mb4;CREATE TABLE IF NOT EXISTS `distributed_lock`
(`lock_key` CHAR(20) NOT NULL,`lock_value` VARCHAR(20) NOT NULL,`expire` BIGINT,primary key (`lock_key`)
) ENGINE = InnoDBDEFAULT CHARSET = utf8mb4;INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0);
四、客户端使用seata
示例由三个服务组成,seataDemoWeb、demo-order、demo-product;
其中seataDemoWeb服务提供rest接口test,此接口调用demo-order和demo-product服务,增加订单记录,修改库存。
4.1 客户端增加undo_log表
demo-order和demo-product,两个服务对应的数据库均需增加undo_log表;
建表语句:
CREATE TABLE `undo_log` (`id` bigint(20) NOT NULL AUTO_INCREMENT,`branch_id` bigint(20) NOT NULL,`xid` varchar(100) NOT NULL,`context` varchar(128) NOT NULL,`rollback_info` longblob NOT NULL,`log_status` int(11) NOT NULL,`log_created` datetime NOT NULL,`log_modified` datetime NOT NULL,`ext` varchar(100) DEFAULT NULL,PRIMARY KEY (`id`),UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
4.2 客户端增加seata相关配置
seataDemoWeb、demo-order和demo-product在application.properties中增加seata配置
seata.enabled=true
seata.application-id=${spring.application.name}
seata.tx-service-group=seata-tx-group
seata.service.vgroup-mapping.seata-tx-group=default
seata.registry.type=nacos
seata.registry.nacos.server-addr=127.0.0.1:8948
seata.registry.nacos.username=nacos
seata.registry.nacos.password=
seata.registry.nacos.namespace=public
seata.registry.nacos.group=SEATA_GROUP
seata.registry.nacos.application=seata-server
pom增加seata依赖,完整pom.xml
<?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><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.2.10.RELEASE</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>hj.example</groupId><artifactId>productDemo</artifactId><version>1.0.0</version><packaging>jar</packaging><properties><lombok.version>1.18.24</lombok.version></properties><dependencies><dependency><groupId>hj.example</groupId><artifactId>demoCommon</artifactId><version>1.0.0</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.12</version></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>${lombok.version}</version></dependency><!-- nacos --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId><version>2.2.5.RELEASE</version></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId><version>2.2.5.RELEASE</version></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-dubbo</artifactId><version>2.2.5.RELEASE</version></dependency><!-- seata --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-seata</artifactId><version>2.2.5.RELEASE</version><exclusions><exclusion><groupId>io.seata</groupId><artifactId>seata-spring-boot-starter</artifactId></exclusion></exclusions></dependency><dependency><groupId>io.seata</groupId><artifactId>seata-spring-boot-starter</artifactId><version>1.7.0</version></dependency></dependencies>
</project>
4.3 客户端使用注解
在seataDemoWeb服务中,增加@GlobalTransaction注解
package hj.example.seatademoweb.controller;import com.baomidou.mybatisplus.extension.service.IService;
import hj.example.democommon.entity.DemoOrder;
import hj.example.democommon.entity.DemoProduct;
import hj.example.democommon.entity.StateEnum;
import hj.example.democommon.services.DemoOrderService;
import hj.example.democommon.services.DemoProductService;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.Random;/*** @Description: TODO* @Author: * @Date: 2023/8/29**/
@RestController
public class TestController {@DubboReference(interfaceName = "demoOrderService")private DemoOrderService demoOrderService;@DubboReference(interfaceName = "demoProductService")private DemoProductService demoProductService;@RequestMapping("/test")@GlobalTransactional(rollbackFor = Exception.class)public ResponseEntity<Object> test() {DemoOrder demoOrder =new DemoOrder();demoOrder.setAccountId("1");demoOrder.setState(StateEnum.NEW.name());demoOrderService.save(demoOrder);DemoProduct demoProduct = new DemoProduct();demoProduct.setNum(Math.random()*10000);demoProductService.save(demoProduct);return new ResponseEntity<>("success", HttpStatus.OK);}
}
五、测试
修改4.3中的代码,debug查看回滚
DemoProduct demoProduct = new DemoProduct();
demoProduct.setNum(1/0);
demoProductService.save(demoProduct);
相关文章:

spring cloud seata集成
目录 一、seata使用场景 二、seata组成 三、seata服务端搭建 四、客户端使用seata 4.1 客户端增加undo_log表 4.2 客户端增加seata相关配置 4.3 客户端使用注解 五、测试 一、seata使用场景 微服务中,一个业务涉及到多个微服务系统,每个微服务…...
HTTP 常⻅的状态码有哪些,以及适⽤场景
⼀、HTTP状态码 HT T P 状态码( HT T P S t a t u s Co d e )是⽤来表示⽹⻚服务器超⽂本传输协议响应状态的 3 位数字代 码。它由 RFC 2 6 1 6 规范定义,并得到 RFC 2 5 1 8 、 RFC 2 8 1 7 、 RFC 2 2 9 5 、 RFC 2 7 7 4 与 RFC 4 9 1 8…...
后端给前端传参数忽略空属性
JsonInclude JsonInclude注解用于指定在对象序列化为JSON字符串时,哪些属性应该被包含进去,哪些属性应该被忽略掉。 JsonInclude注解有以下几个常用选项: JsonInclude(JsonInclude.Include.NON_NULL):表示只有属性值不为null的属…...

SPSS教程:如何绘制带误差的折线图
SPSS教程:如何绘制带误差的折线图 1、问题与数据 研究者想研究45-65岁健康男性中,静坐时长和血胆固醇水平的关系,故招募100名研究对象询问其每天静坐时长(time),并检测其血液中胆固醇水平(cho…...
积分商城小程序如何精细化运营
随着移动互联网的发展,积分商城小程序成为了企业私域营销的重要组成部分。通过积分商城,企业可以激励用户参与、增加用户粘性,实现更好的用户互动和忠诚度提升。然而,要取得成功,积分商城小程序需要经过精细化的运营。…...
企业网络日志管理:EventLog Analyzer的卓越之处
企业网络日志管理对于维护网络安全、监控系统性能和合规性非常重要。随着网络规模和复杂性的增加,管理日志变得越来越具有挑战性。幸运的是,有一些优秀的工具可以帮助企业实现高效的日志管理。其中一款值得一提的工具是EventLog Analyzer。 一、EventLo…...
Python算法——滑动窗口问题
关于滑动窗口的概念,请自行到网上搜索相关资料,了解清楚再看本博客。 一、子组数最大平均数 LeetCode 第643题:https://leetcode.cn/problems/maximum-average-subarray-i/ 给你一个由 n 个元素组成的整数数组 nums 和一个整数 k 。 请你…...

使用 MATLAB 和 Simulink 对雷达系统进行建模和仿真
💥💥💞💞欢迎来到本博客❤️❤️💥💥 🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。 ⛳️座右铭&a…...
Linux 中的 sysctl 命令及示例
介绍 Linux管理员使用该命令在运行时sysctl读取或修改内核参数。无需重新启动即可实时控制和修改网络、 I/O 操作和内存管理设置的选项对于高可用性系统至关重要。 了解如何使用该sysctl命令及其选项来动态调整系统性能。...
Mybatis批量更新数据及其优化
需求场景:定时任务中,从其他平台同步数据,并更新当前平台数据库,表数据3W,分批更新某个字段,耗时巨大,约30min,尝试性能优化。 批量更新的几种常见方式: 1.foreach 循环…...

包含文心一言在内的首批国产大模型 全面开放
8月31起,国内 11 家通过《生成式人工智能服务管理暂行办法》备案的 AI 大模型产品将陆续上线,面向全社会开放。北京 5 家大模型产品分别是百度的 “文心一言”、抖音的 “云雀”、百川智能的 “百川大模型”、清华系 AI 公司智谱华章旗下的 “智谱清言”…...
Linux运维工程师面试题集锦
Linux运维工程师面试题集锦 一、Linux基础问题1.1 Linux的几个常用命令有哪些?1.2 Linux如何查看当前系统版本?1.3 Linux系统的文件权限有哪些?1.4 Linux如何修改文件权限?1.5 如何在Linux系统中查看文件内容?1.6 Linux的发行版本有哪些?1.7 Linux的文件系统是什么样子的…...

深度学习——感受野以及与图像修复的问题
在CNN中,决定某一层输出结果中一个元素所对应的输入层的区域大小被称作感受野(receptive field),指的是神经网络中一个神经元可以感知到的区域,在CNN中,即 上某个元素的计算受输入图像上影响的区域…...

微服务容错 Resilience4j 接口服务-容错原理
微服务容错 Resilience4j 容错原理 4.1 微服务容错简介 在⾼并发访问下,⽐如天猫双11,流量持续不断的涌⼊,服务之间的相互调⽤频率突然增加,引发系统负载过⾼,这时系统所依赖的服务的稳定性对系统的影响⾮常⼤&#…...

OceanBase 4.x改装:另一种全链路追踪的尝试
本文作者:夏克 OceanBase 社区文档贡献者,曾多次参与 OceanBase 技术征文比赛,获得优秀名次。从事金融行业核心系统设计开发工作多年,服务于某交易所子公司,现阶段负责国产数据库调研。 本文为 OceanBase 第七期技术征…...

springCloudAlibaba详解
一、概述 1、简介 Spring Cloud Alibaba,它是由一些阿里巴巴的开源组件和云产品组成的。这个项目的目的是为了给Java开发者带来使用 Spring Boot 和 Spring Cloud 的更多便利。 Spring Cloud Alibaba 致力于 提供微服务开发的一站式解决方案。该项目包含开发分布…...

python通过docker打包执行
背景 正常情况下,python脚本执行需要安装有python环境,那python环境虽然也可以通过移植的方法来安装,那总归是比较麻烦的,下面通过docker打包的方式来执行python脚本 1、安装python镜像 准备两个文件即可,dockerfile、requirements.txt两个文件的内容分别如下 同目录下…...

实现公网远程访问:Windows本地快速搭建SFTP文件服务器并配置端口映射
文章目录 1. 搭建SFTP服务器1.1 下载 freesshd服务器软件1.3 启动SFTP服务1.4 添加用户1.5 保存所有配置 2 安装SFTP客户端FileZilla测试2.1 配置一个本地SFTP站点2.2 内网连接测试成功 3 使用cpolar内网穿透3.1 创建SFTP隧道3.2 查看在线隧道列表 4. 使用SFTP客户端࿰…...
获取文件路径
String fName " D:\\C#_Source\\test\\uploadFile\\test.xlsx";// 方法一: File tempFile new File( fName.trim());String fileName tempFile.getName();System.out.println("fileName " fileName);// 方法二: String fName …...
如何自己实现一个丝滑的流程图绘制工具(八) 创建节点的文本标签
背景 节点的文本标签不希望是通过节点编辑实现,而是拿到节点名字渲染上去,包括连接线 createLabel(element, name, parent) {const modeling this.bpmnModeler.get(modeling)let labelCenter {}// 连接线上的标签if (element.type bpmn:SequenceFlo…...
变量 varablie 声明- Rust 变量 let mut 声明与 C/C++ 变量声明对比分析
一、变量声明设计:let 与 mut 的哲学解析 Rust 采用 let 声明变量并通过 mut 显式标记可变性,这种设计体现了语言的核心哲学。以下是深度解析: 1.1 设计理念剖析 安全优先原则:默认不可变强制开发者明确声明意图 let x 5; …...

docker详细操作--未完待续
docker介绍 docker官网: Docker:加速容器应用程序开发 harbor官网:Harbor - Harbor 中文 使用docker加速器: Docker镜像极速下载服务 - 毫秒镜像 是什么 Docker 是一种开源的容器化平台,用于将应用程序及其依赖项(如库、运行时环…...
脑机新手指南(八):OpenBCI_GUI:从环境搭建到数据可视化(下)
一、数据处理与分析实战 (一)实时滤波与参数调整 基础滤波操作 60Hz 工频滤波:勾选界面右侧 “60Hz” 复选框,可有效抑制电网干扰(适用于北美地区,欧洲用户可调整为 50Hz)。 平滑处理&…...
ubuntu搭建nfs服务centos挂载访问
在Ubuntu上设置NFS服务器 在Ubuntu上,你可以使用apt包管理器来安装NFS服务器。打开终端并运行: sudo apt update sudo apt install nfs-kernel-server创建共享目录 创建一个目录用于共享,例如/shared: sudo mkdir /shared sud…...
Python爬虫实战:研究feedparser库相关技术
1. 引言 1.1 研究背景与意义 在当今信息爆炸的时代,互联网上存在着海量的信息资源。RSS(Really Simple Syndication)作为一种标准化的信息聚合技术,被广泛用于网站内容的发布和订阅。通过 RSS,用户可以方便地获取网站更新的内容,而无需频繁访问各个网站。 然而,互联网…...
spring:实例工厂方法获取bean
spring处理使用静态工厂方法获取bean实例,也可以通过实例工厂方法获取bean实例。 实例工厂方法步骤如下: 定义实例工厂类(Java代码),定义实例工厂(xml),定义调用实例工厂ÿ…...

ETLCloud可能遇到的问题有哪些?常见坑位解析
数据集成平台ETLCloud,主要用于支持数据的抽取(Extract)、转换(Transform)和加载(Load)过程。提供了一个简洁直观的界面,以便用户可以在不同的数据源之间轻松地进行数据迁移和转换。…...

新能源汽车智慧充电桩管理方案:新能源充电桩散热问题及消防安全监管方案
随着新能源汽车的快速普及,充电桩作为核心配套设施,其安全性与可靠性备受关注。然而,在高温、高负荷运行环境下,充电桩的散热问题与消防安全隐患日益凸显,成为制约行业发展的关键瓶颈。 如何通过智慧化管理手段优化散…...

【Java_EE】Spring MVC
目录 Spring Web MVC 编辑注解 RestController RequestMapping RequestParam RequestParam RequestBody PathVariable RequestPart 参数传递 注意事项 编辑参数重命名 RequestParam 编辑编辑传递集合 RequestParam 传递JSON数据 编辑RequestBody …...

Spring Cloud Gateway 中自定义验证码接口返回 404 的排查与解决
Spring Cloud Gateway 中自定义验证码接口返回 404 的排查与解决 问题背景 在一个基于 Spring Cloud Gateway WebFlux 构建的微服务项目中,新增了一个本地验证码接口 /code,使用函数式路由(RouterFunction)和 Hutool 的 Circle…...