【SpringCloud】IDEA如何创建一个SpringCloud项目

2023-11-12

提示:本文包括父工程创建和环境配置,3个子Module为一个简单的订单微服务工程。


新建一个Maven项目

创建一个普通的maven项目
在这里插入图片描述

项目处理

  1. 删除src目录
    在这里插入图片描述
  2. 设置File Encoding都为UTF-8
    在这里插入图片描述
  3. 激活注解
    在这里插入图片描述
  4. 设置版本为8
    在这里插入图片描述

导入依赖

  1. 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>SpringcloudTest</artifactId>
    <version>1.0-SNAPSHOT</version>
    <!-- 第一步 -->
    <packaging>pom</packaging>

    <!-- 统一管理 jar 包版本 -->
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <junit.version>4.12</junit.version>
        <log4j.version>1.2.17</log4j.version>
        <lombok.version>1.16.18</lombok.version>
        <mysql.version>8.0.21</mysql.version>
        <druid.version>1.1.16</druid.version>
        <mybatis.spring.boot.version>1.3.0</mybatis.spring.boot.version>
    </properties>

    <!-- 子块基础之后,提供作用:锁定版本 + 子module不用写 groupId 和 version -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.0.0</version>
            </dependency>

            <!-- 下面三个基本是微服务架构的标配 -->
            <!--spring boot 2.2.2-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.2.2.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!--spring cloud Hoxton.SR1-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Hoxton.SR1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!--spring cloud 阿里巴巴-->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2.1.0.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!--mysql-->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql.version}</version>
                <scope>runtime</scope>
            </dependency>
            <!-- druid-->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>${druid.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>${mybatis.spring.boot.version}</version>
            </dependency>
            <!--junit-->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
            </dependency>
            <!--log4j-->
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>${log4j.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                    <addResources>true</addResources>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
  1. maven中的 dependencyManagement 和 dependencies 的区别?

1.dependencyManagement
一般出现在最顶层父工程的pom文件中,我们会看到dependencyManagement元素。通过它来管理jar包的版本,让子项目中引用一个依赖而不用显示的列出版本号。Maven会沿着父子层次向上走,直到找到一个拥有dependencyManagement元素的项目,然后它就会使用在这个dependencyManagement元素中指定的版本号。【注意】dependencyManagement 声明的依赖并没有被导入项目
2. dependencies
管理项目中所有需要导入的依赖
dependencyManagement里只是声明依赖,并不实现引入,因此子项目需要显示的声明需要用的依赖。如果不在子项目中声明依赖,是不会从父项目中继承下来的;只有在子项目中写了该依赖项,并且没有指定具体版本,才会从父项目中继承该项,并且version和scope都读取自父pom;另外如果子项目中指定了版本号,那么会使用子项目中指定的jar版本。

总结:dependencyManagement里只是声明依赖,并不实现引入,因此子项目需要显示的声明需要用的依赖,如果不在子项目中声明依赖,是不会从父项目中继承下来的;只有在子项目中写了该依赖项,并且没有指定具体版本,才会从父项目中继承该项,并且version和scope都读取自父pom。

关于SpringBoot、SpringCloud、SpringCloudAlibaba版本选择

可以根据网站:https://start.spring.io/actuator/info来选择

{
git: {
branch: "f43bda3cdd3be489aa8ce207fb10c6360aeefdd5",
commit: {
id: "f43bda3",
time: "2021-01-20T10:00:44Z"
}
},
build: {
version: "0.0.1-SNAPSHOT",
artifact: "start-site",
versions: {
spring-boot: "2.4.2",
initializr: "0.10.0-SNAPSHOT"
},
name: "start.spring.io website",
time: "2021-01-20T10:04:03.142Z",
group: "io.spring.start"
},
bom-ranges: {
azure: {
2.2.4: "Spring Boot >=2.2.0.RELEASE and <2.3.0.M1",
3.0.0: "Spring Boot >=2.3.0.M1 and <2.4.0-M1"
},
codecentric-spring-boot-admin: {
2.2.4: "Spring Boot >=2.2.0.RELEASE and <2.3.0.M1",
2.3.1: "Spring Boot >=2.3.0.M1 and <2.5.0-M1"
},
solace-spring-boot: {
1.0.0: "Spring Boot >=2.2.0.RELEASE and <2.3.0.M1",
1.1.0: "Spring Boot >=2.3.0.M1 and <2.5.0-M1"
},
solace-spring-cloud: {
1.0.0: "Spring Boot >=2.2.0.RELEASE and <2.3.0.M1",
1.1.1: "Spring Boot >=2.3.0.M1 and <2.5.0-M1"
},
spring-cloud: {
Hoxton.SR9: "Spring Boot >=2.2.0.RELEASE and <2.3.9.BUILD-SNAPSHOT",
Hoxton.BUILD-SNAPSHOT: "Spring Boot >=2.3.9.BUILD-SNAPSHOT and <2.4.0.M1",
2020.0.0-M3: "Spring Boot >=2.4.0.M1 and <=2.4.0.M1",
2020.0.0-M4: "Spring Boot >=2.4.0.M2 and <=2.4.0-M3",
2020.0.0: "Spring Boot >=2.4.0.M4 and <2.4.3-SNAPSHOT",
2020.0.1-SNAPSHOT: "Spring Boot >=2.4.3-SNAPSHOT"
},
spring-cloud-alibaba: {
2.2.1.RELEASE: "Spring Boot >=2.2.0.RELEASE and <2.3.0.M1"
},
spring-cloud-gcp: {
2.0.0: "Spring Boot >=2.4.0-M1 and <2.5.0-M1"
},
spring-cloud-services: {
2.2.6.RELEASE: "Spring Boot >=2.2.0.RELEASE and <2.3.0.RELEASE",
2.3.0.RELEASE: "Spring Boot >=2.3.0.RELEASE and <2.4.0-M1"
},
spring-geode: {
1.2.12.RELEASE: "Spring Boot >=2.2.0.RELEASE and <2.3.0.M1",
1.3.8.RELEASE: "Spring Boot >=2.3.0.M1 and <2.4.0-M1",
1.4.1: "Spring Boot >=2.4.0-M1 and <2.5.0-M1"
},
vaadin: {
14.4.6: "Spring Boot >=2.1.0.RELEASE and <2.5.0-M1"
},
wavefront: {
2.0.2: "Spring Boot >=2.1.0.RELEASE and <2.4.0-M1",
2.1.0-RC1: "Spring Boot >=2.4.0-M1 and <2.4.3-SNAPSHOT",
2.1.0-SNAPSHOT: "Spring Boot >=2.4.3-SNAPSHOT"
}
},
dependency-ranges: {
okta: {
1.4.0: "Spring Boot >=2.2.0.RELEASE and <2.4.0-M1",
1.5.1: "Spring Boot >=2.4.0-M1 and <2.4.1",
2.0.0: "Spring Boot >=2.4.1 and <2.5.0-M1"
},
mybatis: {
2.1.4: "Spring Boot >=2.1.0.RELEASE and <2.5.0-M1"
},
camel: {
3.3.0: "Spring Boot >=2.2.0.RELEASE and <2.3.0.M1",
3.5.0: "Spring Boot >=2.3.0.M1 and <2.4.0-M1",
3.7.0: "Spring Boot >=2.4.0.M1 and <2.5.0-M1"
},
open-service-broker: {
3.1.1.RELEASE: "Spring Boot >=2.2.0.RELEASE and <2.4.0-M1"
}
}
}

Rest微服务工程构建

前面环境搭建好了,现在正式搭建微服务工程,以订单系统为例:上面配置的为父工程,在父工程下我需要新建3个Module,分别表示:微服务提供者微服务消费者以及两者相同部分重构。【下GIF图为创建Module的步骤】在这里插入图片描述
项目大致结构图:在这里插入图片描述

数据库创建

暂时只需要创建一张订单表:

CREATE TABLE `payment`(
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`serial` VARCHAR(200) DEFAULT '',
PRIMARY KEY(`id`)
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8

公共部分

  1. 新建一个Module为普通的Maven项目cloud-api-commons。
  2. 依赖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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>SpringcloudTest</artifactId>
        <groupId>org.example</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>cloud-api-commons</artifactId>
    <dependencies>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- https://mvnrepository.com/artifact/cn.hutool/hutool-all -->
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>5.1.0</version>
        </dependency>
    </dependencies>

</project>
  1. 在src/main/java下新建包名为com.gaolang.entities,然后创建两个实体类Payment和CommonResult

Payment 类与数据库表对应

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Payment implements Serializable {
    private Long id;
    private String serial;

}

CommonResult类为了配合前后端发,响应码和信息

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CommonResult<T> {
    private Integer code;
    private String message;
    private T data;

    public CommonResult(Integer code,String message){
        this(code,message,null);
    }
}
  1. 做完上面的我们需要对这个Maven项目执行cleaninstall命令(先clean后install)

在这里插入图片描述

微服务提供者

  1. 新建一个Module为普通的Maven项目cloud-provider-payment8001。

  2. 导入依赖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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>SpringcloudTest</artifactId>
        <groupId>org.example</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>cloud-provider-payment8001</artifactId>
    <dependencies>
         <!--导入公共部分实体类cloud-api-commons-->
        <dependency>
            <groupId>org.example</groupId>
            <artifactId>cloud-api-commons</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.10</version>
        </dependency>
        <!--mysql-connector-java-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <!--jdbc-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>
  1. 在resource目录下新建一个application.yml配置文件【设置端口、数据库、mybatis】
server:
  port: 8001

spring:
  application:
    name: cloud-provider-payment8001
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false
    username: root
    password: 123456
mybatis:
  mapper-locations: classpath:mapper/*.xml
  type-aliases-package: com.gaolang.entities  # 所有Entity 别名类所在包
  1. SpringBoot的启动类,在在src/main/java下新建包名为com.gaolang,然后创建一个PaymentMain8001类
@SpringBootApplication
public class PaymentMain8001 {
    public static void main(String[] args) {
        SpringApplication.run(PaymentMain8001.class,args);
    }
}

  1. dao层:在src/main/java下新建包名为com.gaolang.dao,然后创建一个PaymentDao的接口。
@Repository
@Mapper
public interface PaymentDao {
    /**
     *  增加订单操作
     * @param payment  增加的订单
     * @return int
     */
    public int create(Payment payment);

    /**
     *  根据ID查询订单
     * @param id id号
     * @return 订单
     */
    public Payment getPaymentById(@Param("id") Long id);
}

对应在resource/mapper目录下建一个PaymentMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--namespace=绑定一个对应的dao接口/mapper接口-->
<mapper namespace="com.gaolang.dao.PaymentDao">

    <insert id="create" parameterType="Payment" useGeneratedKeys="true" keyProperty="id">
        insert into payment(serial) values (#{serial});
    </insert>
    
    <select id="getPaymentById" parameterType="Long" resultType="Payment">
        select * from payment where id = #{id};
    </select>

</mapper>

  1. service层:调用dao层,在src/main/java下新建包名为com.gaolang.service,然后创建一个PaymentService的接口和实现类PaymentServiceImpl。

PaymentService

public interface PaymentService {
    /**
     *  增加订单操作
     * @param payment  增加的订单
     * @return int
     */
    public int create(Payment payment);

    /**
     *  根据ID查询订单
     * @param id id号
     * @return 订单
     */
    public Payment getPaymentById(@Param("id") Long id);
}

PaymentServiceImpl

@Service
public class PaymentServiceImpl implements PaymentService{

    @Autowired
    private PaymentDao paymentDao;

    @Override
    public int create(Payment payment) {
        return paymentDao.create(payment);
    }

    @Override
    public Payment getPaymentById(Long id) {
        return paymentDao.getPaymentById(id);
    }
}

  1. controller层:调用service层,在src/main/java下新建包名为com.gaolang.controller,然后创建一个PaymentController类
@RestController
@Slf4j
public class PaymentController {

    @Autowired
    private PaymentService paymentService;

    @PostMapping(value = "/payment/create")
    public CommonResult create(@RequestBody Payment payment){

        int result = paymentService.create(payment);
        log.info("====插入结果:  "+result);

        if (result > 0){
            return new CommonResult(200,"数据库插入成功",result);
        }else {
            return new CommonResult(444,"数据库插入失败",null);
        }
    }

    @GetMapping(value = "/payment/{id}")
    public CommonResult getPaymentById(@PathVariable("id") Long id){
        Payment result = paymentService.getPaymentById(id);
        log.info("****查询结果:" + result);
        if(result != null){
            return new CommonResult(200, "查询成功", result);
        }
        return new CommonResult(444, "没有对应id的记录", null);
    }
}
  1. 运行启动类PaymentMain8001,进行测试,在数据库中插入一条id为1的数据,访问:http://localhost:8001/payment/1在这里插入图片描述

微服务消费者

  1. 新建一个Module为普通的Maven项目cloud-customer-order80。

  2. 导入依赖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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>SpringcloudTest</artifactId>
        <groupId>org.example</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>cloud-customer-order80</artifactId>

    <dependencies>
        <dependency>
            <groupId>org.example</groupId>
            <artifactId>cloud-api-commons</artifactId>
            <version>${project.version}</version>
        </dependency>

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

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
  1. 在resource目录下新建一个application.yml配置文件【设置端口】
server:
  port: 80
  1. SpringBoot的启动类,在在src/main/java下新建包名为com.gaolang,然后创建一个OrderMain80类
@SpringBootApplication
public class OrderMain80 {
    public static void main(String[] args) {
        SpringApplication.run(OrderMain80.class,args);
    }
}
  1. config层:配置RestTemplate,新建一个ApplicationContextConfig类
@Configuration
public class ApplicationContextConfig {
    @Bean
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}

  1. controller层:新建一个OrderController类
@RestController
@Slf4j
public class OrderController {

    public static final String PAYMENT_URL = "http://localhost:8001";

    @Autowired
    private RestTemplate restTemplate;

    @PostMapping("customer/payment/create")
    public CommonResult<Payment> create (Payment payment){
        /**
         param1 请求地址,param2 请求参数, param3 返回类型
         */
        return restTemplate.postForObject(PAYMENT_URL + "/payment/create", payment, CommonResult.class);
    }

    @GetMapping("customer/payment/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id")Long id){
        return restTemplate.getForObject(PAYMENT_URL + "/payment/" + id, CommonResult.class);
    }
}
  1. 运行启动进行测试:访问 localhost/customer/payment/create?serial=100001在这里插入图片描述

项目结构图

在这里插入图片描述

小结

6个步骤

  1. 建Module
  2. 改pom
  3. 写YML
  4. 主启动类
  5. 业务类
  6. 测试
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

【SpringCloud】IDEA如何创建一个SpringCloud项目 的相关文章

随机推荐

  • Docker部署Jupyter

    Docker部署Jupyter Docker安装 拉取镜像 docker pull jupyter base notebook 创建挂载目录 mkdir p opt jupyter jovyan chmod 777 opt jupyter
  • 利用 Python PyPDF2库轻松提取PDF文本(及其他高级操作)

    当需要从PDF文件中提取文本时 Python中的PyPDF2库是一个非常有用的工具 无论您是需要分析PDF文档中的内容还是需要在文档中搜索特定的信息 PyPDF2都可以帮助您轻松实现这些任务 在本文中 我们将探讨如何使用PyPDF2库提取P
  • Python编写时钟程序(运行结果在“视频“选项里)(适合学过编程2年00个月~2年11个月的人(中级篇))

    1 初始设置 from datetime import 导入相关库 from turtle import from time import sleep setup 675 675 设置窗口大小 hideturtle 隐藏海龟 mode lo
  • ElasticSearch 7.7.0 高级篇-搜索技术

    前言 有了前面的理论知识和上机实操的经验 那么下面我们将使用程序开发es 当然本篇说白了就是前面知识的总结和回顾 一 ES不分词 exact value 搜索 1 1 实战体验term filter各种不分词搜索 term filter q
  • LdapTemplate对AD域进行查询1000条记录限制,实测有效!

    公司的一个项目要从AD上取数据 但是用SpringLdap获取所有用户的时候会默认显示1000条数据 ldapTemplate search query base OU xxxx DC xxxx where objectclass is p
  • 数据压缩实验之 JPEG原理分析及JPEG解码器的调试

    文章目录 1 实验名称 2 实验目的 3 主要设备 4 实验内容 4 1 JPEG文件格式 4 2 JPEG编解码原理 4 2 1 编码流程 4 2 2 解码流程 5 实验步骤 5 1 逐步调试JPEG解码器程序 5 1 1 理解程序设计的
  • 传统机器学习和深度学习

    传统机器学习 传统机器学习从一些观测 训练 样本出发 试图发现不能通过原理分析获得的规律 实现对未来数据行为或趋势的准确预测 相关算法包括 逻辑回归 隐马尔科夫方法 支持向量机方法 K 近邻方法 三层人工神经网络方法 Adaboost算法
  • 计算机网络 二、网络协议

    一 定义 网络协议是计算机网络中互相通信的对等实体间交换信息时必须要遵守的规则的集合 二 划分层次 三 计算机的体系结构 3 1 具有五层协议的体系结构 具有五层协议的体系结构具 有五层协议的体系结构 1 应用层 application l
  • JNDI和数据库连接池

    1 JNDI 含义 JNDI Java Naming and Directory Interface java命名与目录的接口 是一个有关应用程序设计API 为开发人员提供了查找和访问各种命名和目录服务的通用 统一的接口 使用JNDI的步骤
  • React hooks认知及使用

    Hook介绍 Hook 是 React 16 8 的新增特性 它是完全可选的 并且100 向后兼容 它可以让你使用函数组件的方式 运用类组件以及 react 其他的一些特性 比如管理状态 生命周期钩子等 从概念上讲 React 组件一直更像
  • Jenkins插件开发之突破防火墙

    背景 因为防火墙限制 Jenkins服务端配置完成后 从远程url访问往往受阻 然鹅 并不是任何环境都允许你直接粗暴的将防火墙关闭 解决思路之一 可以单独设置一条规则 开放端口 步骤演示 环境 windows server 2022 1 打
  • Nginx的静态代理

    Nginx的静态代理 Nginx的web请求的处理机制 Nginx结合多进程和异步机制对外提供服务 异步机制使用的是异步非阻塞机制 即AIO Nginx的master进程会生成多个worker进程 master进程负责管理这些worker进
  • 操作系统实验4 使用命名管道实现进程通信

    文章目录 实验4 使用命名管道实现进程通信 一 实验目的 二 实验准备 三 实验内容 一 实验内容 二 主要代码 部分代码 PipeServer cpp PipeClienr cpp 四 实验结果与总结 遇到的问题及解决办法 必看 实验4
  • Open3D 进阶(4)高斯混合点云聚类

    目录 一 算法原理 1 原理概述 2 实现流程 3 参考文献 二 代码实现 三 结果展示 四 测试数据 本文由CSDN点云侠原创 原文链接 爬虫网站自重 一 算法原理 1 原理概述 高斯混合聚类 GMM 算法假设数据点是由一个或多个高斯分布
  • python用户名和密码登录_python编写登录接口

    python编写登录接口 一 需求 编写登录接口 1 输入用户名和密码登录 2 输错三次锁定账户 3 下次登录还是上次的账户 提示锁定 直接退出 用到文件读写 4 成功 后显示登录成功 二 需求流程图 三 代码示例 例1 bin bash
  • 解决Windows jmeter Non HTTP response message: Address already in use: connect 错误

    jMeter报错 Response code Non HTTP response code java net BindException Response message Non HTTP response message Address
  • Xgboost算法——Kaggle案例

    作者简介Introduction 苏高生 西南财经大学统计学硕士毕业 现就职于中国电信 主要负责企业存量客户大数据分析 数据建模 研究方向 机器学习 最喜欢的编程语言 R语言 没有之一 E mail sugs01 outlook com 零
  • 图像上的算术运算(opencv-python学习(2))

    图像上的算术运算 图像加法 图像融合 按位运算 图像加法 通过OpenCV函数 cv add 通过numpy操作 res img1 img2 OpenCV加法是饱和运算 而Numpy加法是模运算 x np uint8 250 y np ui
  • [Qt] tcp服务器连接多个客户端的实现

    Qt tcp服务器连接多个客户端的实现 要求 数据按字节接收 以1 255个字节循环发送 编译环境 Qt 5 9 5 客户端的实现 代码如下 TcpClient h ifndef TCPCLIENT H define TCPCLIENT H
  • 【SpringCloud】IDEA如何创建一个SpringCloud项目

    提示 本文包括父工程创建和环境配置 3个子Module为一个简单的订单微服务工程 文章目录 新建一个Maven项目 项目处理 导入依赖 关于SpringBoot SpringCloud SpringCloudAlibaba版本选择 Rest