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

【Poi-tl Documentation】区块对标签显示隐藏改造

前置说明:

<dependency><groupId>com.deepoove</groupId><artifactId>poi-tl</artifactId><version>1.12.1</version>
</dependency>

模板:
删除行表格测试.docx
image.png

改造前测试效果

package run.siyuan.poi.tl.区对块的改造;import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import com.deepoove.poi.render.RenderContext;
import com.deepoove.poi.xwpf.BodyContainer;
import com.deepoove.poi.xwpf.BodyContainerFactory;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import run.siyuan.poi.tl.policy.CustomRenderPolicy;import java.io.*;
import java.util.HashMap;
import java.util.Map;public class Main {public static void main(String[] args) throws Exception {test1();}public static void test1() throws IOException {// 读取模板文件FileInputStream fileInputStream = new FileInputStream("/Users/wuzhiqian/Desktop/HY/删除行表格测试.docx");// 创建模板配置ConfigureBuilder configureBuilder = Configure.builder();configureBuilder.buildGrammerRegex("((#)?[\\w\\u4e00-\\u9fa5\\-]+(\\.[\\w\\u4e00-\\u9fa5\\-]+)*)?");configureBuilder.setValidErrorHandler(new Configure.ClearHandler() {@Overridepublic void handler(RenderContext<?> context) {System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++");try {XWPFRun run = context.getRun();run.setText("/");BodyContainer bodyContainer = BodyContainerFactory.getBodyContainer(run);bodyContainer.clearPlaceholder(run);} catch (Exception e) {System.out.println("标签不存在-------------------------------------------");}}});// 创建模板上下文Map<String, Object> context = new HashMap<>();context.put("a_1", "1");context.put("b_1", "2");context.put("c_1", "3");context.put("a_2", "4");context.put("b_2", "5");context.put("c_2", "6");context.put("a_3", "7");context.put("b_3", "8");context.put("c_3", "9");context.put("a_4", "10");context.put("b_4", "11");context.put("c_4", "12");context.put("a_5", "13");context.put("b_5", "14");context.put("c_5", "15");context.put("d_1", "16");configureBuilder.addPlugin('!', new CustomRenderPolicy(context));// 使用模板引擎替换文本标签XWPFTemplate compile = XWPFTemplate.compile(fileInputStream, configureBuilder.build());compile.render(context);// 保存生成的文档FileOutputStream outputStream = new FileOutputStream("/Users/wuzhiqian/Desktop/HY/删除行表格测试_" + System.currentTimeMillis() + ".docx");compile.write(outputStream);outputStream.close();compile.close();fileInputStream.close();}}

运行后的效果:
image.png
显示没有问题,但是不是我想要的效果,我想要的效果
image.png
就是通过一个非bool的字段就能判断出我这个区块对的是否显示。

改造开始中

package run.siyuan.poi.tl.区对块的改造;import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.render.compute.RenderDataCompute;
import com.deepoove.poi.render.processor.DocumentProcessor;
import com.deepoove.poi.render.processor.IterableProcessor;
import com.deepoove.poi.resolver.Resolver;
import com.deepoove.poi.template.IterableTemplate;
import com.deepoove.poi.template.MetaTemplate;
import com.deepoove.poi.xwpf.BodyContainer;
import com.deepoove.poi.xwpf.BodyContainerFactory;import java.util.List;/*** @ClassName CustomIterableProcessor* @Description TODO 自定义迭代起处理方法* @Author siyuan* @Date 2024/3/14 23:32*/
public class CustomIterableProcessor extends IterableProcessor {public CustomIterableProcessor(XWPFTemplate template, Resolver resolver, RenderDataCompute renderDataCompute) {super(template, resolver, renderDataCompute);}public void visit(IterableTemplate iterableTemplate) {this.logger.info("【custom】 Process iterableTemplate:{}", iterableTemplate);
//        super.visit(iterableTemplate);BodyContainer bodyContainer = BodyContainerFactory.getBodyContainer(iterableTemplate);// 数据Object compute = this.renderDataCompute.compute(iterableTemplate.getStartMark().getTagName());if (null == compute || compute instanceof Boolean && !(Boolean) compute) {this.handleNever(iterableTemplate, bodyContainer);} else if (compute instanceof Iterable) { // 数据为集合时this.handleIterable(iterableTemplate, bodyContainer, (Iterable) compute);} else if (compute instanceof Boolean && (Boolean) compute) { // 数据为 bool 时this.handleOnceWithScope(iterableTemplate, this.renderDataCompute);} else if (compute instanceof String) { // TODO 数据为字符串时this.handleOnceWithScope(iterableTemplate, this.renderDataCompute);} else if (compute instanceof Number) { // TODO 数据为数字时this.handleOnceWithScope(iterableTemplate, this.renderDataCompute);} else {// 初上出两种类型意外的数据this.handleOnce(iterableTemplate, compute);}this.afterHandle(iterableTemplate, bodyContainer);}}

这块代码主要是新增了 String 和 Number 判断,this.renderDataCompute 相当于示例中的 context,conpute 相当于 a_1 对应的值 1。

package run.siyuan.poi.tl.区对块的改造;import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.render.compute.RenderDataCompute;
import com.deepoove.poi.render.processor.DocumentProcessor;
import com.deepoove.poi.render.processor.ElementProcessor;
import com.deepoove.poi.render.processor.InlineIterableProcessor;
import com.deepoove.poi.resolver.Resolver;
import com.deepoove.poi.template.*;
import com.deepoove.poi.template.run.RunTemplate;
import com.deepoove.poi.xwpf.XWPFTextboxContent;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;import java.util.HashSet;
import java.util.List;
import java.util.Set;/*** @ClassName CustomDocumentProcessor* @Description TODO* @Author siyuan* @Date 2024/3/16 15:27*/
public class CustomDocumentProcessor extends DocumentProcessor {private ElementProcessor elementProcessor;private CustomIterableProcessor iterableProcessor;private InlineIterableProcessor inlineIterableProcessor;public CustomDocumentProcessor(XWPFTemplate template, Resolver resolver, RenderDataCompute renderDataCompute) {super(template, resolver, renderDataCompute);this.elementProcessor = new ElementProcessor(template, resolver, renderDataCompute);this.iterableProcessor = new CustomIterableProcessor(template, resolver, renderDataCompute);this.inlineIterableProcessor = new InlineIterableProcessor(template, resolver, renderDataCompute);}public void process(List<MetaTemplate> templates) {templates.forEach((template) -> {template.accept(this);});Set<XWPFTextboxContent> textboxs = this.obtainTextboxes(templates);textboxs.forEach((content) -> {content.getXmlObject().set(content.getCTTxbxContent());});}private Set<XWPFTextboxContent> obtainTextboxes(List<MetaTemplate> templates) {Set<XWPFTextboxContent> textboxs = new HashSet();if (CollectionUtils.isEmpty(templates)) {return textboxs;} else {templates.forEach((template) -> {RunTemplate checkTemplate = template instanceof RunTemplate ? (RunTemplate) template : (template instanceof BlockTemplate ? ((BlockTemplate) template).getStartMark() : null);if (null != checkTemplate && checkTemplate.getRun().getParent() instanceof XWPFParagraph && checkTemplate.getRun().getParagraph().getBody() instanceof XWPFTextboxContent) {textboxs.add((XWPFTextboxContent) checkTemplate.getRun().getParagraph().getBody());}});return textboxs;}}public void visit(InlineIterableTemplate iterableTemplate) {iterableTemplate.accept(this.inlineIterableProcessor);}public void visit(IterableTemplate iterableTemplate) {iterableTemplate.accept(this.iterableProcessor);}public void visit(RunTemplate runTemplate) {runTemplate.accept(this.elementProcessor);}public void visit(PictureTemplate pictureTemplate) {pictureTemplate.accept(this.elementProcessor);}public void visit(PictImageTemplate pictImageTemplate) {pictImageTemplate.accept(this.elementProcessor);}public void visit(ChartTemplate chartTemplate) {chartTemplate.accept(this.elementProcessor);}
}

新增完 CustomIterableProcessor 类之后就是使用起来,在 CustomDocumentProcessor 中使用起来。

package run.siyuan.poi.tl.区对块的改造;import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.exception.RenderException;
import com.deepoove.poi.policy.DocxRenderPolicy;
import com.deepoove.poi.policy.RenderPolicy;
import com.deepoove.poi.render.DefaultRender;
import com.deepoove.poi.render.compute.RenderDataCompute;
import com.deepoove.poi.render.processor.DelegatePolicy;
import com.deepoove.poi.render.processor.LogProcessor;
import com.deepoove.poi.template.MetaTemplate;
import com.deepoove.poi.template.run.RunTemplate;
import com.deepoove.poi.xwpf.NiceXWPFDocument;
import org.apache.commons.lang3.time.StopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;import java.io.IOException;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;/*** @ClassName CustomDefaultRender* @Description TODO* @Author siyuan* @Date 2024/3/16 15:25*/
public class CustomDefaultRender extends DefaultRender {private static final Logger LOGGER = LoggerFactory.getLogger(DefaultRender.class);public CustomDefaultRender() {}public void render(XWPFTemplate template, Object root) {Objects.requireNonNull(template, "Template must not be null.");Objects.requireNonNull(root, "Data root must not be null");LOGGER.info("Render template start...");RenderDataCompute renderDataCompute = template.getConfig().getRenderDataComputeFactory().newCompute(root);StopWatch watch = new StopWatch();try {watch.start();this.renderTemplate(template, renderDataCompute);this.renderInclude(template, renderDataCompute);} catch (Exception var9) {if (var9 instanceof RenderException) {throw (RenderException)var9;}throw new RenderException("Cannot render docx template", var9);} finally {watch.stop();}LOGGER.info("Successfully Render template in {} millis", TimeUnit.NANOSECONDS.toMillis(watch.getNanoTime()));}private void renderTemplate(XWPFTemplate template, RenderDataCompute renderDataCompute) {(new LogProcessor()).process(template.getElementTemplates());// TODO 调用自定义的 DocumentProcessorCustomDocumentProcessor documentRender = new CustomDocumentProcessor(template, template.getResolver(), renderDataCompute);documentRender.process(template.getElementTemplates());}private void renderInclude(XWPFTemplate template, RenderDataCompute renderDataCompute) throws IOException {List<MetaTemplate> elementTemplates = template.getElementTemplates();long docxCount = elementTemplates.stream().filter((meta) -> {return meta instanceof RunTemplate && ((RunTemplate)meta).findPolicy(template.getConfig()) instanceof DocxRenderPolicy;}).count();if (docxCount >= 1L) {template.reload(template.getXWPFDocument().generate());this.applyDocxPolicy(template, renderDataCompute, docxCount);}}private void applyDocxPolicy(XWPFTemplate template, RenderDataCompute renderDataCompute, long docxItems) {RenderPolicy policy = null;NiceXWPFDocument current = template.getXWPFDocument();List<MetaTemplate> elementTemplates = template.getElementTemplates();int k = 0;while(true) {while(k < elementTemplates.size()) {for(int j = 0; j < elementTemplates.size(); k = j) {MetaTemplate metaTemplate = (MetaTemplate)elementTemplates.get(j);if (metaTemplate instanceof RunTemplate) {RunTemplate runTemplate = (RunTemplate)metaTemplate;policy = runTemplate.findPolicy(template.getConfig());if (policy instanceof DocxRenderPolicy) {DelegatePolicy.invoke(policy, runTemplate, renderDataCompute.compute(runTemplate.getTagName()), template);if (current != template.getXWPFDocument()) {current = template.getXWPFDocument();elementTemplates = template.getElementTemplates();k = 0;break;}}}++j;}}return;}}}

接着就是使用 CustomDocumentProcessor 类型了,CustomDefaultRender 中的 64 行。

package run.siyuan.poi.tl.区对块的改造;import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.exception.ResolverException;
import com.deepoove.poi.resolver.TemplateResolver;
import com.deepoove.poi.xwpf.NiceXWPFDocument;import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;/*** @ClassName CustomXWPFTemplate* @Description TODO* @Author siyuan* @Date 2024/3/16 15:23*/
public class CustomXWPFTemplate {/*** 模拟 {@link XWPFTemplate} 类 {@link #compile(InputStream, Configure)} 方法,通过反射的方式来创建 {@link XWPFTemplate} 并给属性赋值,** @param inputStream* @param config* @return {@link XWPFTemplate}*/public static XWPFTemplate compile(InputStream inputStream, Configure config) {try {Class<XWPFTemplate> xwpfTemplateClass = XWPFTemplate.class;Field docFiled = xwpfTemplateClass.getDeclaredField("doc");docFiled.setAccessible(true);NiceXWPFDocument niceXWPFDocument = new NiceXWPFDocument(inputStream);Field configFiled = xwpfTemplateClass.getDeclaredField("config");configFiled.setAccessible(true);Field resolverFiled = xwpfTemplateClass.getDeclaredField("resolver");resolverFiled.setAccessible(true);Field rendererFiled = xwpfTemplateClass.getDeclaredField("renderer");rendererFiled.setAccessible(true);Field eleTemplatesFiled = xwpfTemplateClass.getDeclaredField("eleTemplates");eleTemplatesFiled.setAccessible(true);Constructor<XWPFTemplate> declaredConstructor = xwpfTemplateClass.getDeclaredConstructor();declaredConstructor.setAccessible(true);XWPFTemplate xwpfTemplate = declaredConstructor.newInstance();docFiled.set(xwpfTemplate, niceXWPFDocument);configFiled.set(xwpfTemplate, config);TemplateResolver templateResolver = new TemplateResolver(config);resolverFiled.set(xwpfTemplate, templateResolver);// TODO 使用自定义的 CustomDefaultRenderrendererFiled.set(xwpfTemplate, new CustomDefaultRender());eleTemplatesFiled.set(xwpfTemplate, templateResolver.resolveDocument(niceXWPFDocument));return xwpfTemplate;} catch (Exception e) {throw new ResolverException("Compile template failed", e);}}}

最后就是用我们自定义的 CustomDefaultRender 了,因为 XWPFTemplate 构造函数是 private,不能使用继承的方式实现,最后我们通过反射的方式来处理,模拟 XWPFTemplate.compile(InputStream, Configure) 方法,通过反射的方式来创建 XWPFTemplate 并给属性赋值,renderer 使用我们自定会的 CustomDefaultRender。
这次改造过程中涉及到的很多方法都是从原有的方法中赋值,改动的部分很少。

改造后测试效果

package run.siyuan.poi.tl.区对块的改造;import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import com.deepoove.poi.render.RenderContext;
import com.deepoove.poi.xwpf.BodyContainer;
import com.deepoove.poi.xwpf.BodyContainerFactory;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import run.siyuan.poi.tl.policy.CustomRenderPolicy;import java.io.*;
import java.util.HashMap;
import java.util.Map;public class Main {public static void main(String[] args) throws Exception {test1();}public static void test1() throws IOException {// 读取模板文件FileInputStream fileInputStream = new FileInputStream("/Users/wuzhiqian/Desktop/HY/删除行表格测试.docx");// 创建模板配置ConfigureBuilder configureBuilder = Configure.builder();configureBuilder.buildGrammerRegex("((#)?[\\w\\u4e00-\\u9fa5\\-]+(\\.[\\w\\u4e00-\\u9fa5\\-]+)*)?");configureBuilder.setValidErrorHandler(new Configure.ClearHandler() {@Overridepublic void handler(RenderContext<?> context) {System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++");try {XWPFRun run = context.getRun();run.setText("/");BodyContainer bodyContainer = BodyContainerFactory.getBodyContainer(run);bodyContainer.clearPlaceholder(run);} catch (Exception e) {System.out.println("标签不存在-------------------------------------------");}}});// 创建模板上下文Map<String, Object> context = new HashMap<>();context.put("a_1", "1");context.put("b_1", "2");context.put("c_1", "3");context.put("a_2", "4");context.put("b_2", "5");context.put("c_2", "6");context.put("a_3", "7");context.put("b_3", "8");context.put("c_3", "9");context.put("a_4", "10");context.put("b_4", "11");context.put("c_4", "12");context.put("a_5", "13");context.put("b_5", "14");context.put("c_5", "15");context.put("d_1", "16");configureBuilder.addPlugin('!', new CustomRenderPolicy(context));// 使用模板引擎替换文本标签XWPFTemplate compile = CustomXWPFTemplate.compile(fileInputStream, configureBuilder.build());compile.render(context);// 保存生成的文档FileOutputStream outputStream = new FileOutputStream("/Users/wuzhiqian/Desktop/HY/删除行表格测试_" + System.currentTimeMillis() + ".docx");compile.write(outputStream);outputStream.close();compile.close();fileInputStream.close();}}

image.png

相关文章:

【Poi-tl Documentation】区块对标签显示隐藏改造

前置说明&#xff1a; <dependency><groupId>com.deepoove</groupId><artifactId>poi-tl</artifactId><version>1.12.1</version> </dependency>模板&#xff1a; 删除行表格测试.docx 改造前测试效果 package run.siyuan…...

第十四届蓝桥杯 三国游戏

一开始的思路就是想着暴力&#xff0c;但是呢&#xff0c;如果真的用暴力一个一个列的话&#xff0c;连30%的数据都搞定不了&#xff0c;所以这里需要考虑别的办法。 这道题的思路就是贪心。 我们这样想&#xff1a;既然要满足至少一个国X>YZ&#xff0c;那么我们何不变成…...

数据结构——通讯录项目

1.通讯录的介绍 顺序表是通讯录的底层结构。 通讯录是将顺序表的类型替换成结构体类型来储存用户数据&#xff0c;通过运用顺序表结构来实现的。 用户数据结构&#xff1a; typedef struct PersonInfo {char name[12];char sex[10];int age;char tel[11];char addr[100]; }…...

学点Java打小工_Day4_数组_冒泡排序

1 数组基本概念 程序算法数据结构 算法&#xff1a;解决程序的流程步骤 数据结构&#xff1a;将数据按照某种特定的结构来存储 设计良好的数据结构会导致良好的算法。 ArrayList、LinkedList 数组是最简单的数据结构。 数组&#xff1a;存放同一种类型数据的集合&#xff0c;在…...

内存分配方式?

内存分配方式主要有三种&#xff1a; 静态存储区分配&#xff1a;这种方式在程序编译的时候就已经分配好内存&#xff0c;并且这块内存在程序的整个运行期间都存在。全局变量和静态变量通常就是在静态存储区分配的。这种分配方式效率高&#xff0c;因为内存在程序开始执行前就已…...

2024/3/17周报

文章目录 摘要Abstract文献阅读题目引言模型架构编码器和解码器堆栈AttentionPosition-wise Feed-Forward NetworksEmbeddings and SoftmaxPositional Encoding 实验数据实验结果 深度学习TransformerEncoderDecoder 总结 摘要 本周阅读了Transformer的开山之作《Attention Is…...

函数连续性和Lipschitz连续性

摘要&#xff1a; 直观上&#xff0c;Lipschitz连续性的含义是函数图像的变化速度有一个全局的上限&#xff0c;即函数的增长速率不会无限增加。这种性质确保了函数在任何地方都不会过于陡峭&#xff0c;有助于分析函数的行为&#xff0c;并且在优化、动力系统理论、机器学习等…...

Qt 鼠标滚轮示例

1.声明 void wheelEvent(QWheelEvent *event) override;2.实现&#xff08;方便复制、测试起见用静态变量&#xff09; #include <mutex> void MainWindow::wheelEvent(QWheelEvent *event) {static QLabel *label new QLabel("Zoom Level: 100%", this);st…...

【Unity】进度条和血条的三种做法

前言 在使用Unity开发的时候&#xff0c;进度条和血条是必不可少的&#xff0c;本篇文章将简单介绍一下几种血条的制作方法。 1.使用Slider Slider组件由两部分组成&#xff1a;滑动区域和滑块。滑动区域用于显示滑动条的背景&#xff0c;而滑块则表示当前的数值位置。用户可…...

多人聊天室 (epoll - Linux网络编程)

文章目录 零、效果展示一、服务器代码二、客户端代码三、知识点1.connect()2.socket()3.bind()4.send()5.recv() 四、改进方向五、跟练视频 零、效果展示 一个服务器作为中转站&#xff0c;多个客户端之间可以相互通信。至少需要启动两个客户端。 三个客户端互相通信 一、服务…...

vite配置

"vite": "^5.1.4" resolve.alias&#xff1a;配置别名 1、执行npm install -D types/node 或者 yarn add types/node -D 2、以下配置代表访问src时可以用“”代替 resolve: {alias: {"": path.resolve(__dirname, "./src"),},}, 使…...

服务器生产环境问题解决思路

游戏服务器开发节奏比较快,版本迭代很频繁,有一些项目甚至出现了周更新(每周准时停服更新维护)。由于功能开发时间短,研发人员本身技术能力等原因,线上出现bug很常见。笔者经历过的游戏项目,一年到头没几次更新不出现bug的(当然,配置问题也算bug)。那当出现bug,我们…...

鸿蒙Harmony应用开发—ArkTS声明式开发(容器组件:Column)

沿垂直方向布局的容器。 说明&#xff1a; 该组件从API Version 7开始支持。后续版本如有新增内容&#xff0c;则采用上角标单独标记该内容的起始版本。 子组件 可以包含子组件。 接口 Column(value?: {space?: string | number}) 从API version 9开始&#xff0c;该接口…...

LLM之RAG实战(三十)| 探索RAG语义分块策略

在LLM之RAG实战&#xff08;二十九&#xff09;| 探索RAG PDF解析解析文档后&#xff0c;我们可以获得结构化或半结构化的数据。现在的主要任务是将它们分解成更小的块来提取详细的特征&#xff0c;然后嵌入这些特征来表示它们的语义&#xff0c;其在RAG中的位置如图1所示&…...

软件测试-------Web(性能测试 / 界面测试 / 兼容性测试 / 安全性测试)

Web&#xff08;性能测试 / 界面测试 / 兼容性测试 / 安全性测试&#xff09; 一、Web性能测试&#xff1a;&#xff08;压力测试、负载测试、连接速度测试&#xff09;1、压力测试&#xff1a;      并发测试 &#xff08;如500人同时登录邮箱&#xff09; 2、负载测试…...

工欲善其事,必先利其器,Markdown和Mermaid的梦幻联动(2)

该文章Github地址&#xff1a;https://github.com/AntonyCheng/typora-notes/tree/master/chapter03-mermaid 在此介绍一下作者开源的SpringBoot项目初始化模板&#xff08;Github仓库地址&#xff1a;https://github.com/AntonyCheng/spring-boot-init-template & CSDN文…...

STM32基础--使用寄存器点亮流水灯

GPIO 简介 GPIO 是通用输入输出端口的简称&#xff0c;简单来说就是 STM32 可控制的引脚&#xff0c;STM32 芯片的 GPIO 引脚与外部设备连接起来&#xff0c;从而实现与外部通讯、控制以及数据采集的功能。STM32 芯片的 GPIO被分成很多组&#xff0c;每组有 16 个引脚&#xf…...

代码随想录训练营Day25:● 216.组合总和III ● 17.电话号码的字母组合

216.组合总和III 题目链接 https://leetcode.cn/problems/combination-sum-iii/description/ 题目描述 思路 自己写的效率会慢一些&#xff0c;而且没有用到剪枝 class Solution {List<List<Integer>> list new ArrayList<>();List<Integer> lis…...

SwiftUI的 特性 - ViewModify

SwiftUI的 特性 - ViewModify 记录一下SwiftUI的 特性 - ViewModify的使用方式 可以通过viewModify来管理视图的样式&#xff0c;结合extension来完成封装达到解偶效果 import SwiftUI/// 我们可以通过viewModify来管理视图的样式&#xff0c;来达到解偶效果 struct DefaultB…...

中间件 | RPC - [Dubbo]

INDEX 1 Dubbo 与 web 容器的关系2 注册发现流程3 服务配置3.1 注册方式 & 订阅方式3.2 服务导出3.3 配置参数 4 底层技术4.1 Dubbo 的 spi 机制4.2 Dubbo 的线程池4.3 Dubbo 的负载均衡策略4.3 Dubbo 的协议 1 Dubbo 与 web 容器的关系 dubbo 本质上是一个 RPC 框架&…...

【中等】保研/考研408机试-二叉树相关

目录 一、基本二叉树 1.1结构 1.2前序遍历&#xff08;注意三种遍历中Visit所在的位置&#xff09; 1.2中序遍历 1.3后序遍历 二、真题实战 2.1KY11 二叉树遍历&#xff08;清华大学复试上机题&#xff09;【较难】 2.2KY212 二叉树遍历二叉树遍历&#xff08;华中科技大…...

自动驾驶---Motion Planning之构建SLT Driving Corridor

1 背景 在上篇博客《自动驾驶---Motion Planning之Speed Boundary》中,主要介绍了Apollo中Speed Boundary的一些内容,可以构造ST图得到边界信息,最后结合粗糙的速度曲线和路径曲线,即可使用优化的方法求解得到最终的轨迹信息(s,s,s,l,l,l)。 本篇博客笔者主要介绍近…...

本地文件包含漏洞利用

目录 前期信息收集获取网站权限获取服务器权限纵向提权 前期信息收集 拿到目标的资产&#xff0c;先试一下IP能不能访问 探测一下目标的端口运行的是什么服务 nmap -sC -sV xx.xx9.95.185 -Pn获取网站权限 我们可以知道目标的80端口上运行着http服务&#xff0c;服务器是u…...

【docker】docker的常用命令

&#x1f4dd;个人主页&#xff1a;五敷有你 &#x1f525;系列专栏&#xff1a;中间件 ⛺️稳中求进&#xff0c;晒太阳 常规命令 docker version #查看docker 版本信息docker info #显示docker 的系统信息&#xff0c;包括镜像和容器数量docker --help #查看所有的命…...

jmeter实战

jmeter学习 1&#xff0c;接口在定义时&#xff0c;post请求参数尽量放在body里面&#xff0c;get请求参数尽量放在parameters里面&#xff0c;否则会导致jmeter请求接口报错的问题(jmeter底层有较为严格的请求格式) 2&#xff0c;定义全局变量使用&#xff1a;Config Elemen…...

面试官常问问题

1、请你简单的自我介绍一下&#xff1f; 【Tips】① 口述内容不可与简历内容冲突&#xff1b;②阐述方式避免过度官方 且语速较快&#xff1b;③言简意赅&#xff0c;直击要害&#xff0c;抓重点突出项&#xff1b;④面试前应自己模拟练习几次&#xff0c;避免过度紧张导致的口…...

外包就干了2个月,技术退步明显....

先说情况&#xff0c;大专毕业&#xff0c;18年通过校招进入湖南某软件公司&#xff0c;干了接近4年的功能测试&#xff0c;今年年初&#xff0c;感觉自己不能够在这样下去了&#xff0c;长时间呆在一个舒适的环境会让一个人堕落!而我已经在一个企业干了四年的功能测试&#xf…...

面向对象 汇总(详细内容见Day12—16)

面向对象 汇总&#xff08;详细内容见Day12—16&#xff09; 文章目录 面向对象 汇总&#xff08;详细内容见Day12—16&#xff09;一、概念二、类三、对象四、成员属性/成员变量五、成员方法六、构造方法七、private - 私有化八、封装九、this - 本对象十、分包十一、static -…...

结构体联合体枚举和位段

文章目录 结构体结构体类型的声明特殊的声明 结构的自引用结构体变量的定义和初始化结构体内存对齐为什么要内存对齐结构体传参结构体实现位段&#xff08;位段的填充&可移植性&#xff09;位段位段的内存分配空间如何开辟位段的跨平台问题位段的应用 枚举枚举类型的定义枚…...

人类程序员真要失业?首位“AI软件工程师”亮相引爆科技圈

初创公司Cognition成立不到两个月&#xff0c;但已经拥有十名天才工程师。他们推出了一款名为Devin的人工智能&#xff08;AI&#xff09;助手&#xff0c;可以协助人类软件工程师完成各种开发任务。Devin与现有的其他AI编码者不同&#xff0c;它能够从头开始构建网站、自动部署…...