记一次学习Activiti7SpringBoot

pom依赖
主要引入activiti依赖于jdbc和mysql依赖

<?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.4.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.thz</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <slf4j.version>1.6.6</slf4j.version>
        <log4j.version>1.2.12</log4j.version>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.29</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.activiti</groupId>
            <artifactId>activiti-spring-boot-starter</artifactId>
            <version>7.0.0.Beta2</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

application.yml配置

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/activiti?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
    username: root
    password: 123456
    driver-class-name: com.mysql.jdbc.Driver
  activiti:
    #1.flase:默认值。activiti在启动时,对比数据库表中保存的版本,如果没有表或者版本不匹配,将抛出异常
    #2.true: activiti会对数据库中所有表进行更新操作。如果表不存在,则自动创建
    #3.create_drop: 在activiti启动时创建表,在关闭时删除表(必须手动关闭引擎,才能删除表)
    #4.drop-create: 在activiti启动时删除原来的旧表,然后在创建新表(不需要手动关闭引擎)
    database-schema-update: true
    #检测历史表是否存在 activiti7默认没有开启数据库历史记录 启动数据库历史记录
    db-history-used: true
    #记录历史等级 可配置的历史级别有none, activity, audit, full #none:不保存任何的历史数据,因此,在流程执行过程中,这是最高效的。
    #activity:级别高于none,保存流程实例与流程行为,其他数据不保存。
    #audit:除activity级别会保存的数据外,还会保存全部的流程任务及其属性。audit为history的默认值。
    #full:保存历史数据的最高级别,除了会保存audit级别的数据外,还会保存其他全部流程相关的细节数据,包括一些 流程参数等。
    history-level: full
    #校验流程文件,默认校验resources下的processes文件夹里的流程文件
    check-process-definitions: false

准备流程文件 mytest.bpmn
在这里插入图片描述

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="myTest" isClosed="false" isExecutable="true" processType="None">
    <startEvent id="Event_1fb6jx2" name="StartEvent"/>
    <userTask activiti:assignee="zhangsan" activiti:exclusive="true"  id="Activity_0vizqus"  name="创建出差申请单"/>
    <userTask activiti:exclusive="true"  id="Activity_0dm0jl0" activiti:assignee="jack" name="总经理审批"/>
    <endEvent id="Event_1ug08ii" name="EndEvent"/>
    <sequenceFlow id="Flow_13wzyw1" sourceRef="Event_1fb6jx2" targetRef="Activity_0vizqus"/>
    <sequenceFlow id="Flow_09pjrbx" sourceRef="Activity_0vizqus" targetRef="Activity_1aomhta"/>
    <sequenceFlow id="Flow_164iiwb" sourceRef="Activity_0dm0jl0" targetRef="Event_1ug08ii"/>
    <serviceTask id="Activity_1aomhta" name="部门经理审批" activiti:expression="${applyActivitiServiceImpl.finalAudit(execution)}"/>
    <sequenceFlow id="Flow_1p1kzwk" sourceRef="Activity_1aomhta" targetRef="Activity_0dm0jl0"/>
  </process>
  <bpmndi:BPMNDiagram documentation="background=#3C3F41;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0" id="Diagram-_1" name="New Diagram">
    <bpmndi:BPMNPlane bpmnElement="myTest">
      <bpmndi:BPMNShape bpmnElement="Event_1fb6jx2" id="Shape-Event_1fb6jx2">
        <omgdc:Bounds height="32.0" width="32.0" x="184.0" y="84.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="Activity_0vizqus" id="Shape-Activity_0vizqus">
        <omgdc:Bounds height="55.0" width="85.0" x="159.0" y="149.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="Activity_0dm0jl0" id="Shape-Activity_0dm0jl0">
        <omgdc:Bounds height="55.0" width="85.0" x="166.0" y="362.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="Event_1ug08ii" id="Shape-Event_1ug08ii">
        <omgdc:Bounds height="32.0" width="32.0" x="193.0" y="454.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="Activity_1aomhta" id="Shape-Activity_1aomhta">
        <omgdc:Bounds height="80.0" width="100.0" x="159.0" y="240.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="80.0" width="100.0" x="0.0" y="0.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="Flow_164iiwb" id="BPMNEdge_Flow_164iiwb" sourceElement="Activity_0dm0jl0" targetElement="Event_1ug08ii">
        <omgdi:waypoint x="209.0" y="417.0"/>
        <omgdi:waypoint x="209.0" y="454.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="Flow_09pjrbx" id="BPMNEdge_Flow_09pjrbx" sourceElement="Activity_0vizqus" targetElement="Activity_1aomhta">
        <omgdi:waypoint x="201.5" y="204.0"/>
        <omgdi:waypoint x="201.5" y="240.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="Flow_13wzyw1" id="BPMNEdge_Flow_13wzyw1" sourceElement="Event_1fb6jx2" targetElement="Activity_0vizqus">
        <omgdi:waypoint x="200.0" y="116.0"/>
        <omgdi:waypoint x="200.0" y="149.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="Flow_1p1kzwk" id="BPMNEdge_Flow_1p1kzwk" sourceElement="Activity_1aomhta" targetElement="Activity_0dm0jl0">
        <omgdi:waypoint x="208.5" y="320.0"/>
        <omgdi:waypoint x="208.5" y="362.0"/>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

启动类排除Spring Security
因为Activiti7与SpringBoot整合后,默认情况下,集成了SpringSecurity安全框架,这样我们就要去准备SpringSecurity整合进来的相关用户权限配置信息。这样就很麻烦,这里可以先排除掉。

@SpringBootApplication(
        exclude = {
                org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
                org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration.class
        }
)

controller

@RestController
public class MyController {
    @Autowired
    ApplyActivitiService applyActivitiService;

    @RequestMapping("/submit")
    public String submitApply(){
        return applyActivitiService.submitApply();
    }

    @RequestMapping("/create")
    public String createApply(String assignee){
        return applyActivitiService.createApply(assignee);
    }

    @RequestMapping("/secondAudit")
    public String secondAudit(String assignee){
        return applyActivitiService.secondAudit(assignee);
    }
}

service

public interface ApplyActivitiService {
    public String submitApply();
    public String createApply(String assignee);
    public String secondAudit(String assignee);
}

实现类

@Service
public class ApplyActivitiServiceImpl implements ApplyActivitiService {

    @Autowired
    ProcessEngine processEngine;

    @Autowired
    RepositoryService repositoryService;

    @Autowired
    RuntimeService runtimeService;

    @Autowired
    TaskService taskService;

    @PostConstruct
    public void init(){
        // 3、使用RepositoryService进行部署
        Deployment deployment = repositoryService.createDeployment()
                .addClasspathResource("bpmn/mytest.bpmn") // 添加bpmn资源
//                .addClasspathResource("bpmn/evection.png") // 添加png资源
                .name("出差申请流程")
                .deploy();
        // 4、输出部署信息
        System.out.println("流程部署id:" + deployment.getId());
        System.out.println("流程部署名称:" + deployment.getName());
    }


    @Override
    public String submitApply() {
        // 3、根据流程定义Id启动流程
        Map<String,Object> variables = new HashMap<>();
        variables.put("myid","123456789");
        ProcessInstance processInstance = runtimeService .startProcessInstanceByKey("myTest",variables);
        // 输出内容
        System.out.println("流程定义id:" + processInstance.getProcessDefinitionId());
        System.out.println("流程实例id:" + processInstance.getId());
        System.out.println("当前活动Id:" + processInstance.getActivityId());
        System.out.println("Name:" + processInstance.getName());
        System.out.println("LocalizedName:" + processInstance.getLocalizedName());
        System.out.println("ProcessDefinitionName:" + processInstance.getProcessDefinitionName());
        return "success";
    }

    @Override
    public String createApply(String assignee) {
        // 根据流程key 和 任务负责人 查询任务
        List<Task> list = taskService.createTaskQuery()
                .processDefinitionKey("myTest") //流程Key
                .taskAssignee(assignee)//只查询该任务负责人的任务
//                .taskId("Activity_0vizqus")
                .list();
        for (Task task : list) {
            System.out.println("流程实例id:" + task.getProcessInstanceId());
            System.out.println("任务id:" + task.getId());
            System.out.println("任务负责人:" + task.getAssignee());
            System.out.println("任务名称:" + task.getName());
            String myid = (String) runtimeService.getVariable(task.getExecutionId(),"myid");
            System.out.println("myid:" + myid);
            Map<String,Object> map = new HashMap<>();
            map.put("bb","BB");
            taskService.complete(task.getId(),map);
        }
        return "scuccess";
    }

    @Override
    public String secondAudit(String assignee) {
        List<Task> list = taskService.createTaskQuery()
                .processDefinitionKey("myTest") //流程Key
                .taskAssignee(assignee)//只查询该任务负责人的任务
//                .taskId("Activity_0dm0jl0")
                .list();
        for (Task task : list) {
            String cc = (String) runtimeService.getVariable(task.getExecutionId(),"cc");
            System.out.println("cc:" + cc);
            taskService.complete(task.getId());
        }
        return "scuccess";
    }

    public void finalAudit(DelegateExecution execution) {
        String bb = (String) execution.getVariable("bb");
        System.out.println("bb:" + bb);
        String myid = (String) execution.getVariable("myid");
        System.out.println("myid:" + myid);
        execution.setVariable("cc","987654321");
    }

}

启动测试

依次调用下面接口

localhost:8080/submit
localhost:8080/create?assignee=zhangsan
localhost:8080/secondAudit?assignee=jack

控制台打印

Connected to the target VM, address: '127.0.0.1:0', transport: 'socket'
SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.4.5)

2021-04-27 14:49:09.326  INFO 15484 --- [           main] com.thz.demo.DemoApplication             : Starting DemoApplication using Java 1.8.0_211 on DESKTOP-0B0L3CT with PID 15484 (D:\test_code\activiti\activitiDemo1\target\classes started by Tang in D:\test_code\activiti\activitiDemo1)
2021-04-27 14:49:09.328  INFO 15484 --- [           main] com.thz.demo.DemoApplication             : No active profile set, falling back to default profiles: default
2021-04-27 14:49:10.256  INFO 15484 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@375084c9' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-04-27 14:49:10.259  INFO 15484 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityConfig' of type [org.activiti.spring.boot.MethodSecurityConfig$$EnhancerBySpringCGLIB$$91e5f2b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-04-27 14:49:10.264  INFO 15484 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-04-27 14:49:10.412  INFO 15484 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-04-27 14:49:10.417  INFO 15484 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-04-27 14:49:10.418  INFO 15484 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-04-27 14:49:10.465  INFO 15484 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-04-27 14:49:10.465  INFO 15484 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1106 ms
2021-04-27 14:49:10.591  INFO 15484 --- [           main] c.t.d.c.DemoApplicationConfiguration     : > Registering new user: jack with the following Authorities[[ROLE_ACTIVITI_USER, GROUP_activitiTeam]]
2021-04-27 14:49:10.658  INFO 15484 --- [           main] c.t.d.c.DemoApplicationConfiguration     : > Registering new user: rose with the following Authorities[[ROLE_ACTIVITI_USER, GROUP_activitiTeam]]
2021-04-27 14:49:10.721  INFO 15484 --- [           main] c.t.d.c.DemoApplicationConfiguration     : > Registering new user: tom with the following Authorities[[ROLE_ACTIVITI_USER, GROUP_activitiTeam]]
2021-04-27 14:49:10.783  INFO 15484 --- [           main] c.t.d.c.DemoApplicationConfiguration     : > Registering new user: other with the following Authorities[[ROLE_ACTIVITI_USER, GROUP_otherTeam]]
2021-04-27 14:49:10.845  INFO 15484 --- [           main] c.t.d.c.DemoApplicationConfiguration     : > Registering new user: system with the following Authorities[[ROLE_ACTIVITI_USER]]
2021-04-27 14:49:10.906  INFO 15484 --- [           main] c.t.d.c.DemoApplicationConfiguration     : > Registering new user: admin with the following Authorities[[ROLE_ACTIVITI_ADMIN]]
2021-04-27 14:49:11.014  INFO 15484 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-04-27 14:49:11.102  INFO 15484 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2021-04-27 14:49:11.199  INFO 15484 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2021-04-27 14:49:11.611  INFO 15484 --- [           main] aultActiviti5CompatibilityHandlerFactory : Activiti 5 compatibility handler implementation not found or error during instantiation : org.activiti.compatibility.DefaultActiviti5CompatibilityHandler. Activiti 5 backwards compatibility disabled.
2021-04-27 14:49:11.633  INFO 15484 --- [           main] o.a.engine.impl.ProcessEngineImpl        : ProcessEngine default created
2021-04-27 14:49:11.758  INFO 15484 --- [           main] o.a.e.impl.bpmn.deployer.BpmnDeployer    : Process deployed: {id: myTest:2:ac5d7800-a724-11eb-9fa0-70b5e84c1e7c, key: myTest}
流程部署id:ac4fbc5e-a724-11eb-9fa0-70b5e84c1e7c
流程部署名称:出差申请流程
2021-04-27 14:49:12.234  INFO 15484 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-04-27 14:49:12.296  INFO 15484 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-04-27 14:49:12.307  INFO 15484 --- [           main] com.thz.demo.DemoApplication             : Started DemoApplication in 3.27 seconds (JVM running for 3.685)
2021-04-27 14:49:12.454  INFO 15484 --- [1)-192.168.1.87] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-04-27 14:49:12.454  INFO 15484 --- [1)-192.168.1.87] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-04-27 14:49:12.455  INFO 15484 --- [1)-192.168.1.87] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
流程定义id:myTest:2:ac5d7800-a724-11eb-9fa0-70b5e84c1e7c
流程实例id:b664e9a1-a724-11eb-9fa0-70b5e84c1e7c
当前活动Id:null
Name:null
LocalizedName:null
ProcessDefinitionName:null
流程实例id:b664e9a1-a724-11eb-9fa0-70b5e84c1e7c
任务id:b6669757-a724-11eb-9fa0-70b5e84c1e7c
任务负责人:zhangsan
任务名称:创建出差申请单
myid:123456789
bb:BB
myid:123456789
cc:987654321

分析

使用@PostConstruct注解在项目启动时自动部署流程
依次执行的三个接口分别执行了启动流程(个人理解为和类 的实例化差不多)、创建出差申请单、总经理审批。因为创建出差申请单和总经理审批为UserTask,需要调用接口执行任务使流程继续向下流动。部门经理审批为ServiceTask,在创建出差申请单后自动完成任务。如果debug启动项目,并在finalAudit方法中打上断点,就会发现在执行完localhost:8080/create?assignee=zhangsan接口后代码并没有执行完,而是进入了finalAudit中的断点。这表明在完成创建申请单任务后,activiti自动去执行下一个ServiceTask了。

关于流程变量,即上面代码中的myid、bb、cc。这些流程变量的作用域为整个流程实例,在设置之后的所有任务都可以使用。通常结合UEL表达式用来控制流程的走向等。
获取某个执行点的变量
RuntimeService
Map<String, Object> getVariables(String executionId);
DelegateExecution
Map<String, Object> getVariables();
Object getVariable(String variableName);
设置某个执行点的变量
RuntimeService
void setVariable(String executionId, String variableName, Object value);
void setVariables(String executionId, Map<String, ? extends Object> variables);
DelegateExecution
void setVariable(String variableName, Object value);
void setVariables(Map<String, ? extends Object> variables);

热门文章

暂无图片
编程学习 ·

exe4j详细使用教程(附下载安装链接)

一、exe4j介绍 ​ exe4j是一个帮助你集成Java应用程序到Windows操作环境的java可执行文件生成工具&#xff0c;无论这些应用是用于服务器&#xff0c;还是图形用户界面&#xff08;GUI&#xff09;或命令行的应用程序。如果你想在任务管理器中及Windows XP分组的用户友好任务栏…
暂无图片
编程学习 ·

AUTOSAR从入门到精通100讲(126)-浅谈车载充电系统通信方案

01 引言 本文深入研究车载充电系统策略,设计出一套基于电动汽车电池管理系统与车载充电机的CAN通信协议,可供电动汽车设计人员参考借鉴。 02 电动汽车充电系统通讯网络 电动汽车整车控制系统中采用的是CAN总线通信方式,由一个整车内部高速CAN网络、内部低速CAN网络和一个充电…
暂无图片
编程学习 ·

CMake(九):生成器表达式

当运行CMake时&#xff0c;开发人员倾向于认为它是一个简单的步骤&#xff0c;需要读取项目的CMakeLists.txt文件&#xff0c;并生成相关的特定于生成器的项目文件集(例如Visual Studio解决方案和项目文件&#xff0c;Xcode项目&#xff0c;Unix Makefiles或Ninja输入文件)。然…
暂无图片
编程学习 ·

47.第十章 网络协议和管理配置 -- 网络配置(八)

4.3.3 route 命令 路由表管理命令 路由表主要构成: Destination: 目标网络ID,表示可以到达的目标网络ID,0.0.0.0/0 表示所有未知网络,又称为默认路由,优先级最低Genmask:目标网络对应的netmaskIface: 到达对应网络,应该从当前主机哪个网卡发送出来Gateway: 到达非直连的网络,…
暂无图片
编程学习 ·

元宇宙技术基础

请看图&#xff1a; 1、通过AR、VR等交互技术提升游戏的沉浸感 回顾游戏的发展历程&#xff0c;沉浸感的提升一直是技术突破的主要方向。从《愤怒的小鸟》到CSGO,游戏建模方式从2D到3D的提升使游戏中的物体呈现立体感。玩家在游戏中可以只有切换视角&#xff0c;进而提升沉浸…
暂无图片
编程学习 ·

flink的伪分布式搭建

一 flink的伪分布式搭建 1.1 执行架构图 1.Flink程序需要提交给 Job Client2.Job Client将作业提交给 Job Manager3.Job Manager负责协调资源分配和作业执行。 资源分配完成后&#xff0c;任务将提交给相应的 Task Manage。4.Task Manager启动一个线程以开始执行。Task Manage…
暂无图片
编程学习 ·

十进制正整数与二进制字符串的转换(C++)

Function one&#xff1a; //十进制数字转成二进制字符串 string Binary(int x) {string s "";while(x){if(x % 2 0) s 0 s;else s 1 s;x / 2;}return s; } Function two&#xff1a; //二进制字符串变为十进制数字 int Decimal(string s) {int num 0, …
暂无图片
编程学习 ·

[含lw+源码等]微信小程序校园辩论管理平台+后台管理系统[包运行成功]Java毕业设计计算机毕设

项目功能简介: 《微信小程序校园辩论管理平台后台管理系统》该项目含有源码、论文等资料、配套开发软件、软件安装教程、项目发布教程等 本系统包含微信小程序做的辩论管理前台和Java做的后台管理系统&#xff1a; 微信小程序——辩论管理前台涉及技术&#xff1a;WXML 和 WXS…
暂无图片
编程学习 ·

树莓派驱动DHT11温湿度传感器

1&#xff0c;直接使用python库 代码如下 import RPi.GPIO as GPIO import dht11 import time import datetimeGPIO.setwarnings(True) GPIO.setmode(GPIO.BCM)instance dht11.DHT11(pin14)try:while True:result instance.read()if result.is_valid():print(ok)print(&quo…
暂无图片
编程学习 ·

ELK简介

ELK简介 ELK是三个开源软件的缩写&#xff0c;Elasticsearch、Logstash、Kibana。它们都是开源软件。不过现在还新增了一个 Beats&#xff0c;它是一个轻量级的日志收集处理工具(Agent)&#xff0c;Beats 占用资源少&#xff0c;适合于在各个服务器上搜集日志后传输给 Logstas…
暂无图片
编程学习 ·

Linux 基础

通常大数据框架都部署在 Linux 服务器上&#xff0c;所以需要具备一定的 Linux 知识。Linux 书籍当中比较著名的是 《鸟哥私房菜》系列&#xff0c;这个系列很全面也很经典。但如果你希望能够快速地入门&#xff0c;这里推荐《Linux 就该这么学》&#xff0c;其网站上有免费的电…
暂无图片
编程学习 ·

Windows2022 无线网卡装不上驱动

想来 Windows2022 和 windows10/11 的驱动应该差不多通用的&#xff0c;但是死活装不上呢&#xff1f; 搜一下&#xff0c;有人提到 “默认安装时‘无线LAN服务’是关闭的&#xff0c;如果需要开启&#xff0c;只需要在“添加角色和功能”中&#xff0c;选择开启“无线LAN服务…
暂无图片
编程学习 ·

【嵌入式面试宝典】版本控制工具Git常用命令总结

目录 创建仓库 查看信息 版本回退 版本检出 远程库 Git 创建仓库 git initgit add <file> 可反复多次使用&#xff0c;添加多个文件git commit -m <message> 查看信息 git status 仓库当前的状态git diff 差异对比git log 历史记录&#xff0c;提交日志--pret…
暂无图片
编程学习 ·

用Postman生成测试报告

newman newman是一款基于nodejs开发的可以运行postman脚本的工具&#xff0c;使用Newman&#xff0c;可以直接从命令运行和测试postman集合。 安装nodejs 下载地址&#xff1a;https://nodejs.org/en/download/ 选择自己系统相对应的版本内容进行下载&#xff0c;然后傻瓜式安…
暂无图片
编程学习 ·

Java面向对象之多态、向上转型和向下转型

文章目录前言一、多态二、引用类型之间的转换Ⅰ.向上转型Ⅱ.向下转型总结前言 今天继续Java面向对象的学习&#xff0c;学习面向对象的第三大特征&#xff1a;多态&#xff0c;了解多态的意义&#xff0c;以及两种引用类型之间的转换&#xff1a;向上转型、向下转型。  希望能…