从零搭建微服务项目Pro(第0章——微服务项目脚手架搭建)
前言:
在本专栏Base第0章曾介绍一种入门级的微服务项目搭建,尽管后续基于此框架上实现了Nacos、Eureka服务注册发现、配置管理、Feign调用、网关模块、OSS文件存储、JSR参数校验、LogBack日志配置,鉴权模块、定时任务模块等,但由于之前的博客更侧重于功能的实现而非整体架构的和谐统一,随着模块和功能的增多,原先框架设计层面上的不足也逐渐暴露出来,代码层面比如实体类存放位置、Exception处理方式难以统一,各层级耦合度高等,依赖方面如循环依赖、依赖冲突等问题也时有发生。因此,笔者通过参考实习公司代码,使用企业级的脚手架搭建方式,最终重构了原有项目,并实现了绝大部分功能。本章将结合代码以及一些个人见解具体介绍,并会介绍一些微服务相关知识帮助快速上手。
最终实现完整项目代码链接如下,后续会逐步迭代并最终完成完整的后端代码,(可能还会包括Vue网页端和OpenHarmony手机端的前端代码),以及详尽的配置文档方便快速入手以及设计文档方便快速了解业务,欢迎Star和Follow。
wlf728050719/BitGoPlushttps://github.com/wlf728050719/BitGoPlus如果没有接触过微服务项目或者对上述功能模块感兴趣的小伙伴可收藏下面专栏目录链接,专栏主要内容为笔者从0接触微服务的全部学习心得和记录。以及建议按时间顺序看循序渐进。
从零搭建微服务项目(全)-CSDN博客https://blog.csdn.net/wlf2030/article/details/145799620?spm=1001.2014.3001.5501
一、前置知识:
为降低本章门槛还是做一些前置知识讲解。如果有一定微服务项目开发基础这部分就可以直接跳过。以及笔者有误的地方也欢迎评论区指出。
1.前端、后端、数据库
前端(客户端):B/S架构下前端主要指网页,C/S架构下主要指手机或电脑上的应用程序,当然也有微信小程序这种混合架构下的前端,前端主要用于和用户交互,并将用户指定通过http请求发送给后端。并展示后端返回数据
后端(服务器):接收前端请求,处理业务逻辑(如验证、计算),并与数据库交互,并将数据作为响应返回前端。
数据库:结构化存储数据(如用户信息、订单记录)。
这里拿BS架构举例,当搜索一次4399后按f12抓包能够看见其发起了一次http请求,请求地址是www.baidu.com以及将输入的值4399和编码格式utf8以及上次搜索的值43999一并发送(请求)给了对应域名的服务器,并成功获取了其返回的数据xml形式数据(响应)。
(注意不是有服务器就是后端,笔者大二学数据库时曾以为安装了数据库的云服务器就是后端,做的课设实际前端既负责处理远程服务器传来的数据又展示界面,当时信誓旦旦的和老师说是CS架构项目,现在看来可能叫CD结构更合适)
2.后端分层架构
(学习过Servlet开发或者Spring MVC/Spring Boot的小伙伴应该对这张图不会陌生。个人所有编程语言最喜欢Java很大程度上在于它把分层解耦的思想发挥到了极致。)
后端按照各自负责功能划分为五层,可以选择将Manager层合并到Service层,笔者更倾向五层架构。图中默认上层依赖于下层,箭头关系表示可直接依赖,如:开放接口层可以依赖于 Web 层,也可以直接依赖于 Service 层,依此类推:


UserManagerImpl属于Manager层,其作用在于对插入数据库的主键进行处理,而非使用数据库生成主键。(个人倾向五层架构的原因也在于如果使用了mybatis plus,在遇到需要对与数据库直接交互数据特殊处理时,放dto中需要手写本来已经实现的crud操作费时费力,放service中与其他业务函数相比比如register、login忽然出现一个insert,update显得不伦不类)

UserServiceImpl属于Service层,能够看到其一个业务函数中使用了多个Manager层数据对象,实现了功能的复用。
UserController属于Web层,其将service层提供的功能封装为一个个接口,供前端访问。比如登录功能,前端只需要发送https://ip地址:port号/user/register并附带上注册所需要的数据即可在数据库中新增一个用户。
终端显示层负责将后端返回的数据(如JSON、XML)转换为用户可理解的界面(如表格、图表、文字),其实理解为前端也行,但一般都采用前后端分离的方式,所以一般不会直接在后端返回一个html页面。
3.微服务架构

服务调用:
微服务架构是一种 将单体应用拆分为多个小型、独立服务 的架构风格,每个服务负责不同的业务功能,比如A服务负责用户,B服务负责订单,各个服务内部可以相互调用,比如订单表中只有用户id,但订单服务需要返回用户完整信息,此时B服务就需要远程调用(RPC)A服务,传给它用户id,并拿取其返回信息拼装返回给前端。
服务调用可参考下面链接:从零搭建微服务项目Base(第1章——微服务模块间调用接口)_搭建一个微服务项目-CSDN博客
从零搭建微服务项目Base(第5章——SpringBoot项目LogBack日志配置+Feign使用)_springboot feign 日志-CSDN博客
从零搭建微服务项目Base(第6章——Feign性能优化以及模块抽取)-CSDN博客
服务注册、网关路由:
当服务从单体拆分成多个后,前端人员编写接口时需要把哪个服务对应哪个ip端口写入程序中,然后每次发请求均需要查询对应接口,这显然不切实际,一旦接口增加,岂不是用户还得升级以下前端配置,注册中心加网关即可很好解决这个问题,每个服务启动时,将自己的服务名和ip端口注册到注册中心,前端只需要记住网关服务的地址即可,所有请求都发向网关,网关中配置哪些请求路径匹配哪些服务,并从注册中心拿到这些服务的地址,网关进行转发即可。同时注册中心会告诉网关哪些服务实例挂了,或者哪些服务现在很忙,通过负载均衡决定到底路由到哪个服务。
服务注册可参考下面链接:
从零搭建微服务项目Base(第2章——Eureka服务注册和发现)_微服务开发实例 服务发现与注册-CSDN博客
从零搭建微服务项目Base(第3章——Nacos服务注册和发现)_nacos服务从零搭建-CSDN博客
网关路由可参考下面链接:
从零搭建微服务项目Base(第7章——微服务网关模块基础实现)-CSDN博客
鉴权:
但此时又出现一个问题,要是我知道你某个服务真实地址,我直接访问它不过你的网关,我直接访问敏感接口猛猛爬用户数据该怎么办,此时就需要为每个服务引入鉴权,你绕过我网关没关系,但你只要访问我的敏感接口就必须提供身份证明(jwt生成的token),同时为了让其他服务能够正常相互调用也需要进一步处理,这里不再细讲。
鉴权可参考下面链接:
从零搭建微服务项目Pro(第6-1章——Spring Security+JWT实现用户鉴权访问与token刷新)_微服务springboot+security+jwt实现刷新token-CSDN博客
配置管理:
既然服务名和ip对应关系已经存放在注册中心,不如多存点,将各服务配置也同样存储,这样就不用将配置也打包,否则一旦配置发生变化岂不是还得重新打包上线。因此nacos,eureka等(注册中心)顺便也做了配置管理。
配置管理可参考下面链接:
从零搭建微服务项目Base(第4章——Nacos环境隔离和配置拉取)_微服务项目搭建 nacos-CSDN博客
分库分表:
既然服务都拆分了,那自然数据库也得拆,否则相当于把热点从服务器转移到了数据库上。分库显然能够减轻单个数据库压力,那分表呢?垂直分表将热点数据集中减小每次数据吞吐量,水平分布则能通过主键id定位使用哪张表,如果分了100张表,则单表的数据量除以100,查询表的速率显然会涨一大截。当然由于分布式系统加分表后如何确保主键唯一以及具体如何使用也需要解决。
分库分表可参考下面链接:
从零搭建微服务项目Pro(第7-1章——分布式雪花算法)_如果当前时间戳对于用例来说是异常的,那么深入到指标,找出时间戳中有高度异-CSDN博客
从零搭建微服务项目Pro(第8-1章——Sharding-Jdbc+MybatisPlus)_mybatis-plus 整合 sharding-jdbc-CSDN博客
缓存:
学习过计组的小伙伴都知道cache的速度远大于磁盘,当然此cache非彼cache,单拿最常用的缓存redis举例,其会将数据以key-value的形式存储,搜索效率远快于数据库逐条查询,因此一般常将不那么频繁变动的数据存在缓存,后端优先使用缓存数据。当然如果sql数据变动一定要及时更改缓存,否则就会出现经典面试题目,数据库和缓存不一致怎么办(延迟双删)。
缓存可参考下面链接:
(-----------------------占位符----------------------还没做------------------------后续更新------------------------)
二、代码约定:
对于代码的某种实现,不同时间可能会有不同的做法,为了统一代码,做了以下约定(其实只是单纯怕自己忘记变成左右手互博),该部分内容在项目readme.md中,会随着项目推进不断迭代(可能会吃书,仅供参考)
(1)表现层业务成功返回R.ok,可预见错误返回R.failed。用户异常操作时(如未授权访问/参数校验错误)均抛出异常(前后端统一)
(2)返回R中不带额外数据时,使用R<Boolean>,需要明确设置true,失败使用false(前后端统一)
(3)除了业务异常以及继承类msg使用中文,其余使用英文(用户友好)
(4)持久层类均与PO或DictItem结尾,对应同名Manager类(统一命名规范)
(5)Manager层负责可复用业务,Service层实现具体业务,原则上每个服务只能有一个service,且其函数与对应接口同名(分层解耦)
(6)所有接口传入对象只能为dto中定义对象,且只有dto中对象添加jsr校验(使参数校验部分统一由Controller负责)
(7)所有dto对象转po对象方法必须定义在dto对象中,且方法固定为newXX明确为两个不同对象(使po专注于与数据库交互)
(8)manager层不对mapper的异常进行特殊处理,抛出统一捕获(便于Service层回滚)
(9)每个服务RPC接口均命名为APIController且统一以/api路径开头(安全配置开放为内部端点,统一鉴权)
(10)通过@Cacheable注解value为命名空间,统一使用KeyGenerator进行管理。使用RedisTemplate则需要统一使用定义在RedisKey文件中的String.format/String形式(防止魔法值,且相同类型缓存使用类似键生成方式方便查询)
(11)所有service层涉及操作manager的方法均需要添加@Transactional(防止数据库脏数据)
(12)各模块内部exception定义在各自模块中,继承BizException或SysException(方便ExceptionHandler统一处理)
(13) 所有实体类必须定义在common-core模块中(否则容易出现循环依赖问题)
三、项目结构
.sql存储建库sql文件
.style存储代码风格规范文件(可参考下面链接)Java静态代码分析工具安装及使用(FindBugs、SpotBugs、SonarQube)以及使用CheckStyle规范阿里代码风格_spotbugs怎么用-CSDN博客
.yaml存储放在nacos上的配置文件,方便配置文件版本管理
auth-service鉴权服务模块
common公共模块定义
common-bom约定依赖版本
common-cache缓存相关模块
common-core存放所有模块pojo,异常声明处理,以及jsr参数校验(可参考下面链接)
从零搭建微服务项目Pro(第2-1章——JSR303自定义参数校验+异常处理)-CSDN博客
从零搭建微服务项目Pro(第2-2章——JSR303自定义文件校验+整合至微服务公共模块)-CSDN博客
common-data数据库模块,上文提到分库分表在此配置
common-feign服务调用模块,上文提到服务调用在此配置
common-security鉴权模块,上文提到鉴权在此配置
gateway网关模块,上文提到网关模块在此配置
order-service订单服务
task-service定时任务服务(可参考下面链接)
从零搭建微服务项目Pro(第1-1章——Quartz实现定时任务模块)_微服务如何处理定时任务-CSDN博客
从零搭建微服务项目Pro(第1-2章——Quartz实现定时任务模块优化)_springcloud quartz模块-CSDN博客
从零搭建微服务项目Pro(第1-3章——Quartz定时任务模块整合)_创建quarz服务和原有服务的交互逻辑-CSDN博客
user-service用户服务
四、Pom文件
虽然此处会展示,但仍然建议在项目文件中查看。
根
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>cn.bit</groupId><artifactId>BitGoPlus</artifactId><version>1.0.0</version><name>${project.artifactId}</name><packaging>pom</packaging><properties><spring-boot.version>2.3.9.RELEASE</spring-boot.version><spring-cloud.version>2.2.5.RELEASE</spring-cloud.version><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target><maven.compiler.version>3.8.1</maven.compiler.version><checkstyle.skip>false</checkstyle.skip></properties><modules><module>user-service</module><module>order-service</module><module>common</module><module>gateway</module><module>task-service</module><module>auth-service</module></modules><dependencyManagement><dependencies><!-- 公共版本定义 --><dependency><groupId>cn.bit</groupId><artifactId>common-bom</artifactId><version>${project.version}</version><type>pom</type><scope>import</scope></dependency><!-- spring boot --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>${spring-boot.version}</version><type>pom</type><scope>import</scope></dependency><!--spring cloud--><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-alibaba-dependencies</artifactId><version>${spring-cloud.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><dependencies><!--lombok--><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><scope>compile</scope><version>1.18.20</version><optional>true</optional></dependency></dependencies><build><resources><!--允许src/main/resources下配置文件读取pom中配置--><resource><directory>src/main/resources</directory><filtering>true</filtering></resource></resources><pluginManagement><plugins><!--checkstyle插件--><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-checkstyle-plugin</artifactId><version>3.6.0</version><dependencies><dependency><groupId>com.puppycrawl.tools</groupId><artifactId>checkstyle</artifactId><version>9.3</version></dependency></dependencies><configuration><outputEncoding>UTF-8</outputEncoding><skip>${checkstyle.skip}</skip><configLocation>.style/alibaba.xml</configLocation><consoleOutput>true</consoleOutput><failsOnError>false</failsOnError><linkXRef>false</linkXRef><includeTestSourceDirectory>false</includeTestSourceDirectory><sourceDirectories>${project.build.sourceDirectory}</sourceDirectories></configuration><executions><execution><id>validate</id><phase>validate</phase><goals><goal>check</goal></goals></execution></executions></plugin><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>${spring-boot.version}</version><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin></plugins></pluginManagement><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>${maven.compiler.version}</version><configuration><target>${maven.compiler.target}</target><source>${maven.compiler.source}</source><encoding>UTF-8</encoding><skip>true</skip></configuration></plugin></plugins></build><!--多环境配置--><profiles><profile><id>dev</id><properties><profile.active>dev</profile.active><nacos.username>nacos</nacos.username><nacos.password>nacos</nacos.password><nacos.server-addr>192.168.200.1:8848</nacos.server-addr><nacos.cluster-name>BJ</nacos.cluster-name><nacos.namespace>5dadfe94-237d-4367-998e-b13d172ddcfc</nacos.namespace><profiles.auth-service.port>1232</profiles.auth-service.port><profiles.gateway.port>1233</profiles.gateway.port><profiles.user-service.port>1234</profiles.user-service.port><profiles.order-service.port>1235</profiles.order-service.port><profiles.quartz-service.port>1236</profiles.quartz-service.port></properties></profile><profile><id>test</id><properties><profile.active>test</profile.active><nacos.username>nacos</nacos.username><nacos.password>nacos</nacos.password><nacos.server-addr>192.168.200.1:8848</nacos.server-addr><nacos.cluster-name>BJ</nacos.cluster-name><nacos.namespace>5dadfe94-237d-4367-998e-b13d172ddcfc</nacos.namespace><profiles.auth-service.port>2232</profiles.auth-service.port><profiles.gateway.port>2233</profiles.gateway.port><profiles.user-service.port>2234</profiles.user-service.port><profiles.order-service.port>2235</profiles.order-service.port><profiles.quartz-service.port>2236</profiles.quartz-service.port></properties></profile><profile><id>prod</id><properties><profile.active>prod</profile.active><nacos.username>nacos</nacos.username><nacos.password>nacos</nacos.password><nacos.server-addr>192.168.200.1:8848</nacos.server-addr><nacos.cluster-name>BJ</nacos.cluster-name><nacos.namespace>5dadfe94-237d-4367-998e-b13d172ddcfc</nacos.namespace><profiles.auth-service.port>3232</profiles.auth-service.port><profiles.gateway.port>3233</profiles.gateway.port><profiles.user-service.port>3234</profiles.user-service.port><profiles.order-service.port>3235</profiles.order-service.port><profiles.quartz-service.port>3236</profiles.quartz-service.port></properties></profile></profiles></project>
common
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>cn.bit</groupId><artifactId>BitGoPlus</artifactId><version>1.0.0</version></parent><artifactId>common</artifactId><packaging>pom</packaging><name>common</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><modules><module>common-bom</module><module>common-core</module><module>common-cache</module><module>common-feign</module><module>common-data</module><module>common-security</module></modules>
</project>
common-bom
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>cn.bit</groupId><artifactId>common-bom</artifactId><version>1.0.0</version><packaging>pom</packaging><name>common-bom</name><url>http://maven.apache.org</url><properties><bitgo.version>1.0.0</bitgo.version><mybatis-plus.version>3.5.1</mybatis-plus.version><sharding-jdbc.version>4.1.1</sharding-jdbc.version><jjwt.version>0.9.1</jjwt.version><jaxb.version>2.3.1</jaxb.version><mysql.connector.version>8.0.28</mysql.connector.version><openfeign.version>2.2.5.RELEASE</openfeign.version><gateway.version>2.2.5.RELEASE</gateway.version></properties><dependencyManagement><dependencies><!-- jwt --><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt</artifactId><version>${jjwt.version}</version></dependency><dependency><groupId>javax.xml.bind</groupId><artifactId>jaxb-api</artifactId><version>${jaxb.version}</version></dependency><dependency><groupId>org.glassfish.jaxb</groupId><artifactId>jaxb-runtime</artifactId><version>${jaxb.version}</version></dependency><!-- sharding jdbc --><dependency><groupId>org.apache.shardingsphere</groupId><artifactId>sharding-jdbc-spring-boot-starter</artifactId><version>${sharding-jdbc.version}</version></dependency><!-- mybatis plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>${mybatis-plus.version}</version></dependency><!-- mysql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>${mysql.connector.version}</version></dependency><!-- open feign --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId><version>${openfeign.version}</version></dependency><!-- gateway --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId><version>${gateway.version}</version></dependency><!-- =============内部依赖版本号============== --><dependency><groupId>cn.bit</groupId><artifactId>common-core</artifactId><version>${bitgo.version}</version></dependency><dependency><groupId>cn.bit</groupId><artifactId>common-cache</artifactId><version>${bitgo.version}</version></dependency><dependency><groupId>cn.bit</groupId><artifactId>common-feign</artifactId><version>${bitgo.version}</version></dependency><dependency><groupId>cn.bit</groupId><artifactId>common-data</artifactId><version>${bitgo.version}</version></dependency><dependency><groupId>cn.bit</groupId><artifactId>common-security</artifactId><version>${bitgo.version}</version></dependency></dependencies></dependencyManagement>
</project>
common-cache
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>cn.bit</groupId><artifactId>common</artifactId><version>1.0.0</version></parent><artifactId>common-cache</artifactId><packaging>jar</packaging><name>common-redis</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><!-- redis --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><!-- cache --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-cache</artifactId></dependency></dependencies>
</project>
common-core
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>cn.bit</groupId><artifactId>common</artifactId><version>1.0.0</version></parent><artifactId>common-core</artifactId><packaging>jar</packaging><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><!-- validation --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-validation</artifactId></dependency><!-- web --><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId></dependency><!-- mybatis plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId></dependency><!-- security --><dependency><groupId>org.springframework.security</groupId><artifactId>spring-security-core</artifactId></dependency></dependencies>
</project>
common-data
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>cn.bit</groupId><artifactId>common</artifactId><version>1.0.0</version></parent><artifactId>common-data</artifactId><packaging>jar</packaging><name>common-mybatis</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><!-- mybatis plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId></dependency><!-- =======内部依赖======= --><!-- common cache --><dependency><groupId>cn.bit</groupId><artifactId>common-cache</artifactId></dependency></dependencies>
</project>
common-feign
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>cn.bit</groupId><artifactId>common</artifactId><version>1.0.0</version></parent><artifactId>common-feign</artifactId><packaging>jar</packaging><name>common-feign</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><!-- web --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- open feign --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId></dependency><!-- =======内部依赖======= --><!-- common-core --><dependency><groupId>cn.bit</groupId><artifactId>common-core</artifactId></dependency></dependencies>
</project>
common-security
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>cn.bit</groupId><artifactId>common</artifactId><version>1.0.0</version></parent><artifactId>common-security</artifactId><packaging>jar</packaging><name>common-security</name><url>http://maven.apache.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><!-- security --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency><!-- web --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- jwt --><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt</artifactId></dependency><dependency><groupId>javax.xml.bind</groupId><artifactId>jaxb-api</artifactId></dependency><dependency><groupId>org.glassfish.jaxb</groupId><artifactId>jaxb-runtime</artifactId></dependency><!-- =======内部依赖======= --><!-- common-core --><dependency><groupId>cn.bit</groupId><artifactId>common-core</artifactId></dependency><!-- common-feign --><dependency><groupId>cn.bit</groupId><artifactId>common-feign</artifactId></dependency><!-- =======内部依赖======= --></dependencies>
</project>
gateway
<?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>cn.bit</groupId><artifactId>BitGoPlus</artifactId><version>1.0.0</version></parent><artifactId>gateway</artifactId><name>gateway</name><description>gateway</description><dependencies><!-- gateway --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId></dependency><!-- =======公共依赖======= --><!-- nacos discovery --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency><!-- nacos config --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId></dependency><!-- =======内部依赖======= --></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
order-service
<?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>cn.bit</groupId><artifactId>BitGoPlus</artifactId><version>1.0.0</version></parent><artifactId>order-service</artifactId><name>order-service</name><description>order-service</description><dependencies><!-- =======公共依赖======= --><!-- web --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- nacos discovery --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency><!-- nacos config --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId></dependency><!-- open feign --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId></dependency><!-- sharding jdbc --><dependency><groupId>org.apache.shardingsphere</groupId><artifactId>sharding-jdbc-spring-boot-starter</artifactId></dependency><!-- mysql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!-- mybatis plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId></dependency><!-- =======内部依赖======= --><!-- common-core --><dependency><groupId>cn.bit</groupId><artifactId>common-core</artifactId></dependency><!-- common-data --><dependency><groupId>cn.bit</groupId><artifactId>common-data</artifactId></dependency><!-- common-cache --><dependency><groupId>cn.bit</groupId><artifactId>common-cache</artifactId></dependency><!-- common-feign --><dependency><groupId>cn.bit</groupId><artifactId>common-feign</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
task-service
<?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>cn.bit</groupId><artifactId>BitGoPlus</artifactId><version>1.0.0</version></parent><artifactId>task-service</artifactId><name>task-service</name><description>task-service</description><dependencies><!-- quartz--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-quartz</artifactId></dependency><!-- =======公共依赖======= --><!-- web --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- nacos discovery --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency><!-- nacos config --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId></dependency><!-- open feign --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId></dependency><!-- sharding jdbc --><dependency><groupId>org.apache.shardingsphere</groupId><artifactId>sharding-jdbc-spring-boot-starter</artifactId></dependency><!-- mysql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!-- mybatis plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId></dependency><!-- =======内部依赖======= --><!-- common-core --><dependency><groupId>cn.bit</groupId><artifactId>common-core</artifactId></dependency><!-- common-data --><dependency><groupId>cn.bit</groupId><artifactId>common-data</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
user-service
<?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>cn.bit</groupId><artifactId>BitGoPlus</artifactId><version>1.0.0</version></parent><artifactId>user-service</artifactId><name>user-service</name><description>user-service</description><dependencies><!-- =======公共依赖======= --><!-- web --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- nacos discovery --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency><!-- nacos config --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId></dependency><!-- open feign --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId></dependency><!-- sharding jdbc --><dependency><groupId>org.apache.shardingsphere</groupId><artifactId>sharding-jdbc-spring-boot-starter</artifactId></dependency><!-- mysql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!-- mybatis plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId></dependency><!-- =======内部依赖======= --><!-- common-core --><dependency><groupId>cn.bit</groupId><artifactId>common-core</artifactId></dependency><!-- common-data --><dependency><groupId>cn.bit</groupId><artifactId>common-data</artifactId></dependency><!-- common-security --><dependency><groupId>cn.bit</groupId><artifactId>common-security</artifactId></dependency><!-- common-cache --><dependency><groupId>cn.bit</groupId><artifactId>common-cache</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
核心为将配置文件定义在根pom中更具不同开发环境选择不同配置,比如nacos地址和各服务端口,并用common-bom统一管理用到所有依赖以及内部common模块的版本信息,再由根pom将其导入通过<dependencyManagement>进而实现对整个项目所用依赖统一管理。
五、服务bootstrap配置文件
server:port: @profiles.order-service.port@spring:profiles:active: @profile.active@application:name: @project.artifactId@cloud:nacos:server-addr: @nacos.server-addr@username: @nacos.username@password: @nacos.password@discovery:cluster-name: @nacos.cluster-name@namespace: @nacos.namespace@group: ${spring.profiles.active}config:cluster-name: ${spring.cloud.nacos.discovery.cluster-name}namespace: ${spring.cloud.nacos.discovery.namespace}group: ${spring.cloud.nacos.discovery.group}file-extension: yamlshared-configs:- data-id: application.yamlgroup: ${spring.profiles.active}refresh: true
snowflake:service-name: ${spring.application.name}
所有服务均使用此bootstrap.yaml文件,不同的配置使用在nacos服务器上的yaml文件,同时各服务公共配置文件为application.yaml。
总结:
理论上使用项目提供的所有配置文件和sql以及代码是能够运行所有服务的,不过由于本章重点在于微服务脚手架的搭建,所以不再具体讲解如何正确配置,后续发布release版本代码会同步更新博客,感兴趣可以start或者follow,基本每周都会有较大新增和改动,当然能自己正确配置的是这个(大拇指)
相关文章:
从零搭建微服务项目Pro(第0章——微服务项目脚手架搭建)
前言: 在本专栏Base第0章曾介绍一种入门级的微服务项目搭建,尽管后续基于此框架上实现了Nacos、Eureka服务注册发现、配置管理、Feign调用、网关模块、OSS文件存储、JSR参数校验、LogBack日志配置,鉴权模块、定时任务模块等,但由于…...
RAG创建向量数据库:docsearch = FAISS.from_texts(documents, embeddings)
RAG创建向量数据库:docsearch = FAISS.from_texts(documents, embeddings) 代码解释 docsearch = FAISS.from_texts(documents, embeddings) 这行代码主要作用是基于给定的文本集合创建一个向量数据库(这里使用 FAISS 作为向量数据库工具 )。具体说明如下: FAISS :FAISS …...
适配python3.9的 SORT算法
简单地更改了 sort.py 函数的接口,核心思想、处理操作并不改变。 源代码链接:https://github.com/abewley/sort import os import numpy as np import glob import time import argparse from filterpy.kalman import KalmanFilter from scipy.optimiz…...
记录Docker部署CosyVoice V2.0
#记录工作 CosyVoice 是由 FunAudioLLM 团队开发的一个开源多语言大规模语音生成模型,提供了从推理、训练到部署的全栈解决方案。 项目地址: https://github.com/FunAudioLLM/CosyVoice.git 该项目目前从v1.0版本迭代到v2.0版本,但是在Wind…...
源码编译 Galera、MySQL 5.7 Wsrep 和安装 MySQL 5.7 Galera集群
源码编译 Galera、MySQL 5.7 Wsrep 和安装 MySQL 5.7 Galera集群 说明1、源码编译 Galera1.1、安装依赖1.2、源码编译安装 openSSL1.2.1、下载源码1.2.2、编译安装 1.3、源码编译安装 Galera 31.3.1、下载源码1.3.2、注意1.3.3、编译安装 2、源码编译 MySQL-Wsrep2.1、安装依赖…...
【SLAM】ubuntu 18.04 下 OpenCV 3.2.0 的 opencv_example 运行闪退
本文首发于❄慕雪的寒舍 ubuntu 18.04 下 OpenCV 3.2.0 的 opencv_example 运行闪退问题探究。 1. 问题说明 在之前的ORB-SLAM3项目于ROS运行的博客中,提到过安装ROS时会自己安装一个OpenCV 3.2.0版本,所以最好不要安装其他版本的OpenCV,避…...
Linux网络编程——数据链路层详解,以太网、MAC地址、MTU、ARP、DNS、NAT、代理服务器......
目录 一、前言 二、以太网 二、以太网帧格式 三、 MAC地址 四、MTU 1、数据链路层的数据分片 2、MTU对UDP协议的影响 3、MTU对TCP协议的影响 五、ARP协议 1、什么是ARP 2、ARP的作用 3、ARP协议的工作流程 4、ARP缓存表 5、ARP请求报文 6、中间人 六、DNS&…...
Android7 Input(四)InputReader
概述 本文主要描述了Android Input框架中的InputReader的功能,InputReader模块的功能,总结成一句话就是InputReader获取输入设备的事件并将事件进行加工处理,然后传递给QueuedInputListener,最终QueuedInputListener将事件传递给…...
游戏报错?MFC140.dll怎么安装才能解决问题?提供多种MFC140.dll丢失修复方案
MFC140.dll 是 Microsoft Visual C 2015 运行库的重要组成部分,许多软件和游戏依赖它才能正常运行。如果你的电脑提示 "MFC140.dll 丢失" 或 "MFC140.dll 未找到",说明系统缺少该文件,导致程序无法启动。本文将详细介绍 …...
寻找最大美丽数
# 输入:nums1 [4,2,1,5,3], nums2 [10,20,30,40,50], k 2 # 输出:[80,30,0,80,50] import random class Solution:def findMaxSum(self, nums1, nums2, k):hash_table []sum1 0data []print(**31,\n,\t数据)for key,values in enumerate(nums1):da…...
[Linux]进程地址空间
前言 我们在学习C语言期间,经常可以提及到这些区域,有一个问题:这里的地址空间是内存吗?答案是这里的地址空间并不是内存。这里的地址空间是进程地址空间,下面我们就讲解进程地址空间。 这段空间中自下而上ÿ…...
dfs和bfs算法
DFS(深度优先搜索,Depth-First Search)和 BFS(广度优先搜索,Breadth-First Search)是图遍历或搜索算法中的两种基本方法。它们在探索图的节点时采用不同的策略,适用于不同的场景。 ### 深度优先…...
跨站请求是什么?
介绍 跨站请求(Cross-Site Request)通常是指浏览器在访问一个网站时,向另一个域名的网站发送请求的行为。这个概念在 Web 安全中非常重要,尤其是在涉及到“跨站请求伪造(CSRF)”和“跨域资源共享ÿ…...
【深度学习与大模型基础】第9章-条件概率以及条件概率的链式法则
简单理解条件概率 条件概率就是在已知某件事发生的情况下,另一件事发生的概率。用数学符号表示就是: P(A|B) 在B发生的前提下,A发生的概率。 计算机例子:垃圾邮件过滤 假设你写了一个程序来自动判断邮件是否是垃圾邮件…...
C++: 获取auto的实际类型
auto a "hello";auto* b "hello";auto& c "hello";上述 a, b, c 类型分别是什么? 在不使用 IDE 提供的 inlay hints 情况下, 可以编译期获取,然后运行时打印出来: 方法: 用 decltype(var)…...
谷歌开源代理开发工具包(Agent Development Kit,ADK):让多智能体应用的构建变得更简
每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗?订阅我们的简报,深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同,从行业内部的深度分析和实用指南中受益。不要错过这个机会,成为AI领…...
揭开人工智能与机器学习的神秘面纱:开发者的视角
李升伟 编译 人工智能(AI)和机器学习(ML)早已不再是空洞的流行语——它们正在彻底改变我们构建软件、做出决策以及与技术互动的方式。无论是自动化重复性任务,还是驱动自动驾驶汽车,AI/ML都是现代创新的核…...
35.Java线程池(线程池概述、线程池的架构、线程池的种类与创建、线程池的底层原理、线程池的工作流程、线程池的拒绝策略、自定义线程池)
一、线程池概述 1、线程池的优势 线程池是一种线程使用模式,线程过多会带来调度开销,进而影响缓存局部性和整体性能,而线程池维护着多个线程,等待着监督管理者分配可并发执行的任务,这避免了在处理短时间任务时创建与…...
【NumPy科学计算:高性能数组操作核心指南】
目录 前言:技术背景与价值当前技术痛点解决方案概述目标读者说明 一、技术原理剖析核心概念图解关键技术模块技术选型对比 二、实战演示环境配置要求核心代码实现运行结果验证 三、性能对比测试方法论量化数据对比结果分析 四、最佳实践推荐方案 ✅常见错误 ❌调试技…...
软考 系统架构设计师系列知识点之杂项集萃(50)
接前一篇文章:软考 系统架构设计师系列知识点之杂项集萃(49) 第78题 著作权中,()的保护期不受限制。 A. 发表权 B. 发行权 C. 署名权 D. 展览权 正确答案:C。 所属知识点:旧版…...
实现定长的内存池
池化技术 所谓的池化技术,就是程序预先向系统申请过量的资源,然后自己管理起来,以备不时之需。这个操作的价值就是,如果申请与释放资源的开销较大,提前申请资源并在使用后并不释放而是重复利用,能够提高程序…...
定制一款国密浏览器(7):铜锁和BoringSSL
上一章简单介绍了一下国密算法,本章开始进入实战,进行国密算法的移植。算法的移植以铜锁为蓝本,移植到 BoringSSL 中。 BoringSSL 也是由 OpenSSL fork 而来,那能否修改 Chromium 的源码,使用铜锁库呢?这种方式我也考虑并尝试过,最后发现两者的接口差别太大,Chromium …...
Docker 安装CRMEB陀螺匠教程
首先下载代码到服务器中,打开终端,并切换到项目源码根目录: 通过 Docker compose 启动项目 第一次启动时需要拉取和打包相关镜像,所需时长视网络情况而定,需耐心等待。 配置反向代理 参考 Nginx 配置 Nginx 反向代…...
Java中的static都能用来修饰什么?
在Java编程语言中,static关键字是非常重要的修饰符,可以用于多种不同的地方。可用来修饰变量、方法、代码块以及类。 1.静态变量 定义:静态变量属于类本身,而不是类的任何特定实例(new出来的对象)。 特点&a…...
词法分析器设计实验
掌握生成词法分析器的方法,加深对词法分析原理的理解。掌握设计、编制并调试词法分析程序的思想和方法。本实验是高级语言程序设计、数据结构和编译原理中词法分析原理等知识的综合。 【实验内容及要求】完善以下代码(红色标注处)并加上注释(蓝色标注处) int Getsym…...
matlab求和∑函数方程编程?
matlab求和∑函数方程编程? 一 题目:求下列函数方程式的和 二:代码如下: >> sum_result 0; % 初始化求和变量 for x 1:10 % 设…...
Vue3.5 企业级管理系统实战(十四):动态主题切换
动态主题切换是针对用户体验的常见的功能之一,我们可以自己实现如暗黑模式、明亮模式的切换,也可以利用 Element Plus 默认支持的强大动态主题方案实现。这里我们探讨的是后者通过 CSS 变量设置的方案。 1 组件准备 1.1 修改 Navbar 组件 在 src/layo…...
Python中for循环及其相关函数range(), zip(), enumerate()等
一、Python中的for循环及其相关函数 Python的for循环是算法竞赛中最常用的迭代工具之一,因其简洁和灵活性非常适合快速实现逻辑。以下详细讲解for循环及相关函数在竞赛中的使用场景。 1. for循环基本语法 Python的for循环用于遍历可迭代对象(如列表、…...
数据结构与算法——链表OJ题详解(2)
文章目录 一、前言二、OJ续享2.1相交链表2.2环形链表12.2环形链表2 三、总结 一、前言 哦了兄弟们,咱们上次在详解链表OJ题的时候,有一部分OJ题呢up并没有整理完,这一个星期呢,up也是在不断的学习并且沉淀着,也是终于…...
免费送源码:Java+ssm+MySQL 基于PHP在线考试系统的设计与实现 计算机毕业设计原创定制
摘 要 信息化社会内需要与之针对性的信息获取途径,但是途径的扩展基本上为人们所努力的方向,由于站在的角度存在偏差,人们经常能够获得不同类型信息,这也是技术最为难以攻克的课题。针对在线考试等问题,对如何通过计算…...
Android之JNI详解
Android之JNI详解 简介创建项目注册动态注册静态注册 关键词解读基础数据类型引用java对象JNI引用与释放cmake配置文件 简介 JNI(Java Native Interface) 是 Java 提供的一种编程框架,用于在 Java 应用程序中调用和与用其他编程语言…...
React Hooks: useRef,useCallback,useMemo用法详解
1. useRef(保存引用值) useRef 通常用于保存“不会参与 UI 渲染,但生命周期要长”的对象引用,比如获取 DOM、保存定时器 ID、WebSocket等。 新建useRef.js组件,写入代码: import React, { useRef, useSt…...
Java基础知识
概念 请介绍全局变量和局部变量的区别 Java中的变量分为成员变量和局部变量,它们的区别如下: 成员变量: 1. 成员变量是在类的范围里定义的变量; 2. 成员变量有默认初始值; 3. 未被static修饰的成员变量也叫…...
体验智能体构建过程:从零开始构建Agent
1. 什么是智能体? 智能体(Agents)是一种能够感知环境、做出决策并采取行动来实现特定目标的自主实体。智能体的复杂程度各不相同,从简单的响应式智能体(对刺激直接做出反应)到更高级的智能体(能…...
如何从项目目标到成功标准:构建可量化、可落地的项目评估体系
引言 在项目管理领域,"项目成功"的定义往往比表面看起来更复杂。根据PMI的行业报告,67%的项目失败源于目标与成功标准的不匹配。当项目团队仅关注"按时交付"或"预算达标"时,常会忽视真正的价值创造。本文将通…...
大模型论文:Language Models are Few-Shot Learners(GPT3)
大模型论文:Language Models are Few-Shot Learners(GPT3) 文章地址:https://proceedings.neurips.cc/paper_files/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf 一、摘要 我们证明了,扩大语言模型的规模在任务无关的 few…...
驱动学习专栏--字符设备驱动篇--1_chrdevbase
字符设备驱动简介 字符设备是 Linux 驱动中最基本的一类设备驱动,字符设备就是一个一个字节,按照字节 流进行读写操作的设备,读写数据是分先后顺序的。比如我们最常见的点灯、按键、 IIC 、 SPI , LCD 等等都是字符设备&…...
muduo库源码分析: TcpConnection
一. 主要成员: socket_:用于保存已连接套接字文件描述符。channel_:封装了上面的socket_及其各类事件的处理函数(读、写、错误、关闭等事件处理函数)。这个Channel中保存的各类事件的处理函数是在TcpConnection对象构造函数中注册…...
【SLAM】ubuntu 18.04 编译安装 OpenCV 3.2.0 时出现哈希错误
本文首发于❄慕雪的寒舍 1. 前言 1.1. 问题说明 在amd64的ubuntu 18.04 desktop上编译安装 OpenCV 3.2.0 的时候,我遇到了cmake构建错误。错误的核心报错如下 for file: [/home/king/slam/pkg/opencv-3.2.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32…...
挂马漏洞 asp连接冰蝎webshell (附webshell源码 仅限学习研究)
目录 ASP WebShell代码 代码说明: 部署步骤: 使用冰蝎客户端连接: 注意事项: ASP WebShell代码 <% 冰蝎连接密码(需与冰蝎客户端配置一致) Dim key key "mysecretkey123" 自定义密码…...
Grafana将弃用AngularJS-我们该如何迁移
AngularJS 弃用时间线 AngularJS 支持已在 Grafana 9 中正式弃用。在 2024 年 5 月发布的 Grafana 11 中,所有 Grafana Cloud 和自托管安装默认关闭该功能。到 Grafana 12 版本时,将完全移除对 AngularJS 的支持,包括配置参数开关 angular_s…...
基于单片机的病房呼叫系统设计
2.1 总体方案设计 本课题为基于单片机的病房呼叫系统设计,在此将整个系统架构设计如图2.1所示,在此采用八个按键模拟8个不同的病房号,再通过8个LED指示灯对病房号的状态进行指示,当用户按键按键时,相应的LED灯会点亮…...
简述一下Unity的UnityWebRequest
UnityWebRequest是Unity引擎中用于处理网络请求的强大工具,尤其适用于与Web服务器进行交互,比如获取数据、上传文件或下载资源等。相较于旧版的WWW类,UnityWebRequest提供了更灵活、更高效的API,支持多种HTTP方法,并能…...
文件操作和IO - 2
目录 Java 中操作文件 File 概述 属性 构造方法 方法 getParent getName getPath getAbsolutePath getCanonicalPath exists isFile isDirectory createNewFile delete deleteOnExit list listFiles mkdir mkdirs 完! Java 中操作文件 Java 对于文件操…...
⑪数据中心网络M-LAG实战
一、DeviceA-M-LAG-Mater配置 1、M-LAG 系统配置。 # m-lag mad exclude interface GigabitEthernet1/0/7 m-lag mad exclude interface Vlan-interface100 m-lag mad exclude interface Vlan-interface101 m-lag system-mac 0002-0002-0002 m-lag system-number 1 m-la…...
Win10系统安装WSL2-Ubuntu, 并使用VScode开始工作
本教程基于博主当前需要使用 WSL2(Windows Subsystem for Linux 2) 而编写,将自己使用的经过分享给大家。有什么意见建议敬请大家批评指正。此过程需要打开 Microsoft Store 话不多说,立即开始~ 文章目录 1. 检查系统版本2. 启动 WSL 功能3. 安装Ubuntu4…...
Node.js种cluster模块详解
Node.js 中 cluster 模块全部 API 详解 1. 模块属性 const cluster require(cluster);// 1. isMaster // 判断当前进程是否为主进程 console.log(是否为主进程:, cluster.isMaster);// 2. isWorker // 判断当前进程是否为工作进程 console.log(是否为工作进程:, cluster.isW…...
Window 10使用WSL2搭建Linux版Android Studio应用开发环境
一、背景 公司基于高通SA8155、SA8295等车载芯片进行座舱系统开发,使用repo统一管理系统及应用源码仓库。 Android应用端使用Ubuntu环境Android Studio进行开发,使用repo进行平台性管理,包含所有应用仓库。由于gradle配置使用了linux下文件软链接,无法直接使用Window环境…...
PostgreSQL 的统计信息
PostgreSQL 的统计信息 PostgreSQL 的统计信息是查询优化和性能调优的基础,系统通过多种统计信息来评估数据分布和访问模式,从而生成高效的执行计划。 一 统计信息类型与用途 1.1 核心统计类别 统计类型存储位置主要用途更新机制表和索引扫描统计pg_…...