当前位置: 首页 > news >正文

聊聊如何玩转spring-boot-admin

前言

1、何为spring-boot-admin?

Spring Boot Admin 是一个监控工具,旨在以良好且易于访问的方式可视化 Spring Boot Actuators 提供的信息

快速开始

如何搭建spring-boot-admin-server

1、在服务端项目的POM引入相应的GAV

  <dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-starter-server</artifactId><version>${spring-boot-admin.version}</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>

2、新建springboot启动类并加上@EnableAdminServer

@SpringBootApplication
@EnableAdminServer
public class MonitorApplication {public static void main(String[] args) {SpringApplication.run(MonitorApplication.class);}
}

配置完,访问一下页面

虽然可以访问,但是这样不安全,接下来我们和spring security做个整合

3、整合spring security

a、 在服务端项目的pom引入security GAV

 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency>

b、 在服务端项目的application.yml配置相关用户名和密码

spring:security:user:name: ${MONITOR_USER:admin}password: ${MONITOR_PWD:admin}

c、 定制security config

@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
public class SecurityMonitorConfig extends WebSecurityConfigurerAdapter {private final AdminServerProperties adminServer;private final WebEndpointProperties webEndpointProperties;@Overrideprotected void configure(HttpSecurity http) throws Exception {SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();successHandler.setTargetUrlParameter("redirectTo");successHandler.setDefaultTargetUrl(this.adminServer.path("/"));http.authorizeRequests().requestMatchers(new AntPathRequestMatcher(this.adminServer.path("/assets/**"))).permitAll().requestMatchers(new AntPathRequestMatcher(this.adminServer.path(webEndpointProperties.getBasePath() + "/info"))).permitAll().requestMatchers(new AntPathRequestMatcher(adminServer.path(webEndpointProperties.getBasePath() + "/health"))).permitAll().requestMatchers(new AntPathRequestMatcher(this.adminServer.path("/login"))).permitAll().anyRequest().authenticated().and().formLogin().loginPage(this.adminServer.path("/login")).successHandler(successHandler).and().logout().logoutUrl(this.adminServer.path("/logout")).and().httpBasic().and().csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()).ignoringRequestMatchers(new AntPathRequestMatcher(this.adminServer.path("/instances"), POST.toString()),new AntPathRequestMatcher(this.adminServer.path("/instances/*"), DELETE.toString()),new AntPathRequestMatcher(this.adminServer.path(webEndpointProperties.getBasePath() + "/**")));http.rememberMe((rememberMe) -> rememberMe.key(UUID.randomUUID().toString()).tokenValiditySeconds(1209600));}}

配置完访问一下页面


输入用户名和密码 admin/admin


如果对整合安全认证还有疑问,可以直接参考官网
https://docs.spring-boot-admin.com/current/security.html

4、页面定制

如果我们觉得登录的springboot admin logo个性化不强,我们可以简单定制一下

在application.yml做如下配置

spring:boot:admin:ui:title: ${UI_TITLE:LYB-GEEK Monitor}brand: <img src="assets/img/icon-spring-boot-admin.svg"><span>${spring.boot.admin.ui.title}</span>

配置好访问一下


如果有些导航栏,我们觉得不需要,比如去掉关于我们

spring:boot:admin:ui:view-settings:- name: "about"enabled: false

注: view-settings这个配置需要是2.3.1以上版本才有的属性

配置好访问一下


发现关于我们已经去掉了,以上只是简单定制,更多定制可以参考如下链接
https://docs.spring-boot-admin.com/current/customize_ui.html

5、与注册中心集成

a、 在服务端项目中pom引入eureka-client GAV

  <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency>

b、 在application.yml文件引入eureka 客户端相关配置

eureka:instance:instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${server.port}}prefer-ip-address: ${PREFER_IP:true}  #是否选择IP注册#   ip-address: ${IP_ADDRESS:localhost}   #指定IP地址注册lease-renewal-interval-in-seconds: 5  #续约更新时间间隔(默认30秒),使得eureka及时剔除无效服务lease-expiration-duration-in-seconds: 10 #续约到期时间(默认90秒)hostname: ${HOSTNAME:${spring.application.name}}client:service-url:defaultZone: ${EUREKA_CLIENT_SERVICEURL_DEFAULTZONE:http://localhost:8761/eureka/}#缩短延迟向服务端注册的时间、默认40sinitial-instance-info-replication-interval-seconds: 10#提高Eureka-Client端拉取Server注册信息的频率,默认30sregistry-fetch-interval-seconds: 5

访问eureka控制面板


服务端的配置暂且说到这边,接下来我们说下客户端集成

如何搭建spring-boot-admin-client

1、在客户端项目的POM配置相关GAV

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-starter-client</artifactId><version>${spring-boot-admin-client.version}</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency>

2、客户端暴露actuator相关端点

management:endpoints:web:exposure:include: "*" endpoint:health:show-details: ALWAYS

3、配置spring-boot-admin服务端地址

spring:boot:admin:client:url: http://localhost:8080

启动观察控制台,会发现有如下信息

原因是因为我们服务端配置了鉴权,因此我们客户端还需做如下配置

spring:boot:admin:client:url: http://localhost:8080username: adminpassword: admin

配置好,观察控制台,发现没异常信息,此时我们访问服务端监控面板


如图说明客户端搭建成功

4、配置应用信息

默认我们查看服务端监控面板–应用列表详情,会发现


这个信息是空的,我们可以在yml配置形如下内容

info:groupId: @project.groupId@artifactId: @project.artifactId@version: @project.version@describe: 这是一个微服务应用

再次访问服务端监控面板

其实这个采的就是actuator/info端点。当然可以像官方介绍的示例,在项目的POM引入springboot插件,并指定goal为build-info

<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions><execution><goals><goal>build-info</goal></goals></execution></executions></plugin></plugins>
</build>

5、在服务端监控面板集成客户端日志

默认是没集成客户端日志,如图


通过官网
在这里插入图片描述
我们知道要配置logging.file.path或者logging.file.name

示例配置

logging:file:path: ${LOG_FILE_PATH:/data/logs/cloud-mini-comsumer}

logback-spring相关配置如下

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false"><include resource="org/springframework/boot/logging/logback/defaults.xml"/><property name="serviceName" value="cloud-mini-comsumer"/><property name="logHome" value="/data/logs/${serviceName}"/><contextName>${serviceName}</contextName><!--输出到控制台--><appender name="console" class="ch.qos.logback.core.ConsoleAppender"><encoder><pattern>${CONSOLE_LOG_PATTERN}</pattern></encoder></appender><!--按天生成日志--><appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender"><Prudent>true</Prudent><rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><FileNamePattern>${logHome}/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log</FileNamePattern><maxHistory>30</maxHistory></rollingPolicy><layout class="ch.qos.logback.classic.PatternLayout"><Pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</Pattern></layout></appender><root level="info"><appender-ref ref="console"/><appender-ref ref="logFile"/></root></configuration>

我们配置后,出现日志文件按钮,点击后出现

那就很诡异,明明按官网配置了,后面排查发现,其他服务可以出现日志,他们配置日志目录底下,都会生成一个spring.log日志,那意味着只要能生成spring.log即可。于是我们调整一下logback-spring,将

 <include resource="org/springframework/boot/logging/logback/defaults.xml"/>

调整为

 <include resource="org/springframework/boot/logging/logback/base.xml" />

然后重新访问服务端监控面板


发现有日志出来了。那为毛加了这个base.xml就有用,那是因为这个日志采集的端点是actuator/logfile。因为本文不是讲解源码,我就把相关核心源码,贴在下面,感兴趣的朋友可以根据下面提供的源码,进行debug调试

核心源码

@WebEndpoint(id = "logfile")
public class LogFileWebEndpoint {private static final Log logger = LogFactory.getLog(LogFileWebEndpoint.class);private File externalFile;private final LogFile logFile;public LogFileWebEndpoint(LogFile logFile, File externalFile) {this.externalFile = externalFile;this.logFile = logFile;}@ReadOperation(produces = "text/plain; charset=UTF-8")public Resource logFile() {Resource logFileResource = getLogFileResource();if (logFileResource == null || !logFileResource.isReadable()) {return null;}return logFileResource;}private Resource getLogFileResource() {if (this.externalFile != null) {return new FileSystemResource(this.externalFile);}if (this.logFile == null) {logger.debug("Missing 'logging.file.name' or 'logging.file.path' properties");return null;}return new FileSystemResource(this.logFile.toString());}}
public class LogFile {/*** The name of the Spring property that contains the name of the log file. Names can* be an exact location or relative to the current directory.* @deprecated since 2.2.0 in favor of {@link #FILE_NAME_PROPERTY}*/@Deprecatedpublic static final String FILE_PROPERTY = "logging.file";/*** The name of the Spring property that contains the directory where log files are* written.* @deprecated since 2.2.0 in favor of {@link #FILE_PATH_PROPERTY}*/@Deprecatedpublic static final String PATH_PROPERTY = "logging.path";/*** The name of the Spring property that contains the name of the log file. Names can* be an exact location or relative to the current directory.* @since 2.2.0*/public static final String FILE_NAME_PROPERTY = "logging.file.name";/*** The name of the Spring property that contains the directory where log files are* written.* @since 2.2.0*/public static final String FILE_PATH_PROPERTY = "logging.file.path";private final String file;private final String path;/*** Create a new {@link LogFile} instance.* @param file a reference to the file to write*/LogFile(String file) {this(file, null);}/*** Create a new {@link LogFile} instance.* @param file a reference to the file to write* @param path a reference to the logging path to use if {@code file} is not specified*/LogFile(String file, String path) {Assert.isTrue(StringUtils.hasLength(file) || StringUtils.hasLength(path), "File or Path must not be empty");this.file = file;this.path = path;}/*** Apply log file details to {@code LOG_PATH} and {@code LOG_FILE} system properties.*/public void applyToSystemProperties() {applyTo(System.getProperties());}/*** Apply log file details to {@code LOG_PATH} and {@code LOG_FILE} map entries.* @param properties the properties to apply to*/public void applyTo(Properties properties) {put(properties, LoggingSystemProperties.LOG_PATH, this.path);put(properties, LoggingSystemProperties.LOG_FILE, toString());}private void put(Properties properties, String key, String value) {if (StringUtils.hasLength(value)) {properties.put(key, value);}}@Overridepublic String toString() {if (StringUtils.hasLength(this.file)) {return this.file;}return new File(this.path, "spring.log").getPath();}

加了那个logback-base可以的原因是,点开base.xml

6、客户端与注册中心集成

说实话spring-boot-admin我看过的,基本上都是用在微服务场景比较多,因此后面的内容,我以集成注册中心为核心来讲解示例,通过url配置服务端监控地址就不再论述。

a、 在客户端项目的pom引入eureka-client GAV

 <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency>

b、 配置eureka 客户端相关信息

eureka:instance:instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${random.uuid}}prefer-ip-address: ${PREFER_IP:false}  #是否选择IP注册#   ip-address: ${IP_ADDRESS:localhost}   #指定IP地址注册lease-renewal-interval-in-seconds: 5  #续约更新时间间隔(默认30秒),使得eureka及时剔除无效服务lease-expiration-duration-in-seconds: 10 #续约到期时间(默认90秒)hostname: ${HOSTNAME:${spring.application.name}}metadata-map:ipAddress: ${spring.cloud.client.ip-address}management:address: ${spring.cloud.client.ip-address}client:service-url:defaultZone: ${EUREKA_CLIENT_SERVICEURL_DEFAULTZONE:http://localhost:8761/eureka/}#缩短延迟向服务端注册的时间、默认40sinitial-instance-info-replication-interval-seconds: 10#提高Eureka-Client端拉取Server注册信息的频率,默认30sregistry-fetch-interval-seconds: 5

注: 客户端和服务端集成的eureka地址必须得同一个

客户端和服务端同时配置好注册中心后,我们访问一下服务端监控面板


和用url配置服务端地址的效果一样,到这边大体就差不多了。但是实际使用,没那么简单。我们列举几种场景

场景一:客户端的默认端点不是actuator

因为公司有时候会有等保要求,正常是不能直接暴露actuator端点,所以我们客户端,可能会将端点路径改个名字,比如改成如下

management:endpoints:web:base-path: ${MONINTOR_BASE_PATH:/lyb-geek}exposure:include: "*"

此时通过服务端监控面板访问

会发现爆红了,点击爆红的面板进去

健康检测404,我们可以通过配置注册中心的元数据,示例如下

eureka:instance:metadata-map:management:context-path: ${management.endpoints.web.base-path:/actuator}

此时我们再访问服务端监控面板


发现可以正常访问了。

场景二:客户端的actuator需要认证才能访问

当我们没有通过认证,直接访问服务端监控面板时



会出现401,未授权访问,此时我们在注册中心配置形如下内容

eureka:instance:metadata-map:user.name: ${spring.security.user.name}user.password: ${spring.security.user.password}

访问服务端监控面板

已经可以正常访问

场景三:客户端通过hostName注册到注册中心,服务端监控面板只显示一个实例

这个场景出现在容器化部署,因为此时hostName和port都一样,因此这个客户端就被当成是同一个。此时通过如下配置

eureka:instance:metadata-map:management:address: ${spring.cloud.client.ip-address}

通过配置management.address指定ip

注: 想知道spring-boot-admin可以支持哪些注册中心元数据,可以查看官网
https://docs.spring-boot-admin.com/current/server.html


也看可以查看源码

de.codecentric.boot.admin.server.cloud.discovery.DefaultServiceInstanceConverter

如何为spring-boot-admin集成告警

以集成邮件告警为例,在服务端的POM引入邮件发送的GAV

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-mail</artifactId></dependency>

在服务端的application.yml配置邮件发送配置

spring:mail:host: ${MAIL_HOST:邮箱服务器地址}port:username: ${MAIL_USERNAME:邮箱服务器用户名}password: ${MAIL_PWD:邮箱服务器密码}protocol: ${MAIL_PROTOCOL:smtp}default-encoding: UTF-8properties:mail.smtp.auth: truemail.smtp.starttls.enable: truemail.smtp.starttls.required: truemail.smtp.socketFactory.port: ${MAIL_SMTP_SOCKETFACTORY_PORT:465}mail.smtp.socketFactory.class: javax.net.ssl.SSLSocketFactorymail.smtp.socketFactory.fallback: falsemail.smtp.ssl.protocols: ${MAIL_SMTP_SSL_PROTOCOLS:TLSv1}

配置邮件通知接收人和发送人

spring:boot:admin:notify:mail:to: ${NOTIFY_MAIL_TO:邮箱接收人,多个用,隔开}from: ${NOTIFY_MAIL_FROM:邮箱发送人}

当客户端出现异常时,会收到形如下告警

更多告警的玩法可以参考官网
https://docs.spring-boot-admin.com/current/server-notifications.html

总结

spring-boot-admin其实核心就做了一件事,就是把Spring Boot Actuators 可视化。本文就不提供demo了,因为官网文档写得很详细,大部分内容都可以从官网找到https://docs.spring-boot-admin.com/current/。除了那个日志稍微有点坑

相关文章:

聊聊如何玩转spring-boot-admin

前言 1、何为spring-boot-admin&#xff1f; Spring Boot Admin 是一个监控工具&#xff0c;旨在以良好且易于访问的方式可视化 Spring Boot Actuators 提供的信息 快速开始 如何搭建spring-boot-admin-server 1、在服务端项目的POM引入相应的GAV <dependency><grou…...

rocky(centos) 安装redis,并设置开机自启动

一、下载并安装 1、官网下载Redis 并安装 Download | RedisRedisYou can download the last Redis source files here. For additional options, see the Redis downloads section below.Stable (7.2)Redis 7.2 …https://redis.io/download/ 2、上传下载好的redis压缩包到 /…...

Flask狼书笔记 | 06_电子邮件

文章目录 6 电子邮件6.1 使用Flask-Mail发送6.2 使用事务邮件服务SendGrid6.3 电子邮件进阶6.4 小结 6 电子邮件 Web中&#xff0c;我们常在用户注册账户时发送确认邮件&#xff0c;或是推送信息。邮件必要的字段包含发信方(sender)&#xff0c;收信方(to)&#xff0c;邮件主题…...

ChatGPT追祖寻宗:GPT-1论文要点解读

论文地址&#xff1a;《Improving Language Understanding by Generative Pre-Training》 最近一直忙着打比赛&#xff0c;好久没更文了。这两天突然想再回顾一下GPT-1和GPT-2的论文&#xff0c; 于是花时间又整理了一下&#xff0c;也作为一个记录~话不多说&#xff0c;让我们…...

回归拟合 | 灰狼算法优化核极限学习机(GWO-KELM)MATLAB实现

这周有粉丝私信想让我出一期GWO-KELM的文章&#xff0c;因此乘着今天休息就更新了(希望不算晚) 作者在前面的文章中介绍了ELM和KELM的原理及其实现&#xff0c;ELM具有训练速度快、复杂度低、克服了传统梯度算法的局部极小、过拟合和学习率的选择不合适等优点&#xff0c;而KEL…...

Mysql JSON

select json_extract(c2, $.a) select c2->"$.a" // json_extract的语法糖 &#xff08;取出的值会保留"双引号" so不适合实战&#xff09; 注&#xff1a;mysql若是引擎Mariadb则不支持json操作符-&#xff1e;&#xff1e;语法糖 select c2->…...

使用Vue + axios实现图片上传,轻松又简单

目录 一、Vue框架介绍 二、Axios 介绍 三、实现图片上传 四、Java接收前端图片 一、Vue框架介绍 Vue是一款流行的用于构建用户界面的开源JavaScript框架。它被设计用于简化Web应用程序的开发&#xff0c;特别是单页面应用程序。 Vue具有轻量级、灵活和易学的特点&#xf…...

C# 中什么是重写(子类改写父类方法)

方法重写是指在继承关系中&#xff0c;子类重新实现父类或基类的某个方法。这种方法允许子类根据需要修改或扩展父类或基类的方法功能。在面向对象编程中&#xff0c;方法重写是一种多态的表现形式&#xff0c;它使得子类可以根据不同的需求和场景提供不同的方法实现。 方法重…...

【Leetcode-面试经典150题-day22】

目录 97. 交错字符串 97. 交错字符串 题意&#xff1a; 给定三个字符串 s1、s2、s3&#xff0c;请你帮忙验证 s3 是否是由 s1 和 s2 交错 组成的。 两个字符串 s 和 t 交错 的定义与过程如下&#xff0c;其中每个字符串都会被分割成若干 非空 子字符串&#xff1a; s s1 s2 …...

LDAP服务器如何重启

1、find / -name ldap 该命令只会从根路径下查看ldap文件夹 find / -name ldap2、该命令会从根路径/查看所有包含ldap路径的文件夹&#xff0c;会查询出所有&#xff0c;相当于全局查询 find / -name *ldap*2、启动OpenLADP 找到LDAP安装目录后&#xff0c;执行以下命令 #直…...

AP51656 LED车灯电源驱动IC 兼容替代PT4115 PT4205 PWM和线性调光

产品描述 AP51656是一款连续电感电流导通模式的降压恒流源 用于驱动一颗或多颗串联LED 输入电压范围从 5V 到 60V&#xff0c;输出电流 可达 1.5A 。根据不同的输入电压和 外部器件&#xff0c; 可以驱动高达数十瓦的 LED。 内置功率开关&#xff0c;采用高端电流采样设置 …...

浅析安防视频监控平台EasyCVR视频融合平台接入大量设备后是如何维持负载均衡的

安防视频监控平台EasyCVR视频融合平台可拓展性强、视频能力灵活、部署轻快&#xff0c;可支持的主流标准协议有国标GB28181、RTSP/Onvif、RTMP等&#xff0c;以及支持厂家私有协议与SDK接入&#xff0c;包括海康Ehome、海大宇等设备的SDK等。视频汇聚融合管理平台EasyCVR既具备…...

SIEM 中不同类型日志监控及分析

安全信息和事件管理&#xff08;SIEM&#xff09;解决方案通过监控来自网络的不同类型的数据来确保组织网络的健康安全状况&#xff0c;日志数据记录设备上发生的每个活动以及整个网络中的应用程序&#xff0c;若要评估网络的安全状况&#xff0c;SIEM 解决方案必须收集和分析不…...

【java基础复习】java中的数组在内存中是如何存储的?

基本数据类型与内存存储数组类型与内存存储为什么数组需要两块空间&#xff1f;感谢 &#x1f496; 基本数据类型与内存存储 首先&#xff0c;让我们回顾一下基本数据类型的内存存储方式。对于一个基本类型变量&#xff0c;例如int类型的变量a&#xff0c;内存中只有一块内存空…...

MySQL数据库 MHA高可用

MySQL MHA 什么是 MHA MHA&#xff08;MasterHigh Availability&#xff09;是一套优秀的MySQL高可用环境下故障切换和主从复制的软件。 MHA 的出现就是解决MySQL 单点的问题。 MySQL故障切换过程中&#xff0c;MHA能做到0-30秒内自动完成故障切换操作。 MHA能在故障切换的…...

leetcode669. 修剪二叉搜索树(java)

修剪二叉搜索树 题目描述递归代码演示&#xff1a; 题目描述 难度 - 中等 LC - 669. 修剪二叉搜索树 给你二叉搜索树的根节点 root &#xff0c;同时给定最小边界low 和最大边界 high。通过修剪二叉搜索树&#xff0c;使得所有节点的值在[low, high]中。修剪树 不应该 改变保留…...

计算机网络的故事——确认访问用户身份的认证

确认访问用户身份的认证 HTTP使用的认证方式&#xff1a;BASIC认证&#xff08;基本认证&#xff09;、DIGEST&#xff08;摘要认证&#xff09;、SSL客户端认证、FormBase认证&#xff08;基于表单认证&#xff09;。 基于表单的认证&#xff1a;涉及到session管理以及cookie…...

C#禁用或启用任务管理器

参考文档https://zhuanlan.zhihu.com/p/95156063 借助上述参考文档里的C#操作注册表类&#xff0c;禁用或启用任务管理器 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace HideTaskMgr { class Program { …...

【Redis】NoSQL之Redis的配置及优化

关系数据库与非关系数据库 关系型数据库 关系型数据库是一个结构化的数据库&#xff0c;创建在关系模型&#xff08;二维表格模型&#xff09;基础上&#xff0c;一般面向于记录。 SQL 语句&#xff08;标准数据查询语言&#xff09;就是一种基于关系型数据库的语言&a…...

【数据库】如何利用Python中的petl将PostgreSQL中所有表的外键删除,迁移数据,再重建外键

一、简介 在数据库管理中&#xff0c;外键是一种重要的约束&#xff0c;用于确保数据的一致性和完整性。然而&#xff0c;在某些情况下&#xff0c;我们可能需要删除或修改外键。本文将介绍如何使用Python中的petl库将PostgreSQL中所有表的外键删除&#xff0c;迁移数据&#…...

大话软工笔记—需求分析概述

需求分析&#xff0c;就是要对需求调研收集到的资料信息逐个地进行拆分、研究&#xff0c;从大量的不确定“需求”中确定出哪些需求最终要转换为确定的“功能需求”。 需求分析的作用非常重要&#xff0c;后续设计的依据主要来自于需求分析的成果&#xff0c;包括: 项目的目的…...

React hook之useRef

React useRef 详解 useRef 是 React 提供的一个 Hook&#xff0c;用于在函数组件中创建可变的引用对象。它在 React 开发中有多种重要用途&#xff0c;下面我将全面详细地介绍它的特性和用法。 基本概念 1. 创建 ref const refContainer useRef(initialValue);initialValu…...

1688商品列表API与其他数据源的对接思路

将1688商品列表API与其他数据源对接时&#xff0c;需结合业务场景设计数据流转链路&#xff0c;重点关注数据格式兼容性、接口调用频率控制及数据一致性维护。以下是具体对接思路及关键技术点&#xff1a; 一、核心对接场景与目标 商品数据同步 场景&#xff1a;将1688商品信息…...

代码随想录刷题day30

1、零钱兑换II 给你一个整数数组 coins 表示不同面额的硬币&#xff0c;另给一个整数 amount 表示总金额。 请你计算并返回可以凑成总金额的硬币组合数。如果任何硬币组合都无法凑出总金额&#xff0c;返回 0 。 假设每一种面额的硬币有无限个。 题目数据保证结果符合 32 位带…...

Caliper 负载(Workload)详细解析

Caliper 负载(Workload)详细解析 负载(Workload)是 Caliper 性能测试的核心部分,它定义了测试期间要执行的具体合约调用行为和交易模式。下面我将全面深入地讲解负载的各个方面。 一、负载模块基本结构 一个典型的负载模块(如 workload.js)包含以下基本结构: use strict;/…...

android13 app的触摸问题定位分析流程

一、知识点 一般来说,触摸问题都是app层面出问题,我们可以在ViewRootImpl.java添加log的方式定位;如果是touchableRegion的计算问题,就会相对比较麻烦了,需要通过adb shell dumpsys input > input.log指令,且通过打印堆栈的方式,逐步定位问题,并找到修改方案。 问题…...

Linux入门课的思维导图

耗时两周&#xff0c;终于把慕课网上的Linux的基础入门课实操、总结完了&#xff01; 第一次以Blog的形式做学习记录&#xff0c;过程很有意思&#xff0c;但也很耗时。 课程时长5h&#xff0c;涉及到很多专有名词&#xff0c;要去逐个查找&#xff0c;以前接触过的概念因为时…...

比较数据迁移后MySQL数据库和ClickHouse数据仓库中的表

设计一个MySQL数据库和Clickhouse数据仓库的表数据比较的详细程序流程,两张表是相同的结构,都有整型主键id字段,需要每次从数据库分批取得2000条数据,用于比较,比较操作的同时可以再取2000条数据,等上一次比较完成之后,开始比较,直到比较完所有的数据。比较操作需要比较…...

【靶场】XXE-Lab xxe漏洞

前言 学习xxe漏洞,搭了个XXE-Lab的靶场 一、搭建靶场 现在需要登录,不知道用户名密码,先随便试试抓包 二、判断是否存在xxe漏洞 1.首先登录抓包 看到xml数据解析,由此判断和xxe漏洞有关,但还不确定xxe漏洞是否存在。 2.尝试xxe 漏洞 判断是否存在xxe漏洞 A.send to …...

浏览器工作原理01 [#]Chrome架构:仅仅打开了1个页面,为什么有4个进程

引用 浏览器工作原理与实践 Chrome打开一个页面需要启动多少进程&#xff1f;你可以点击Chrome浏览器右上角的“选项”菜单&#xff0c;选择“更多工具”子菜单&#xff0c;点击“任务管理器”&#xff0c;这将打开Chrome的任务管理器的窗口&#xff0c;如下图 和Windows任务管…...