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

Vue + Springboot 文件上传项目笔记(一)

Vue + Springboot 文件上传项目笔记(一)

前端

  • 使用脚手架创建项目
vue create vue_fileuploaddemo
  • 等待命令执行完毕
  • 添加 element-ui 组件
E:\java\idea_java_maven\vue_fileuploaddemo>yarn add element-ui
yarn add v1.22.19
[1/4] Resolving packages...
warning element-ui > async-validator > babel-runtime > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > element-ui@2.15.13" has incorrect peer dependency "vue@^2.5.17".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 8 new dependencies.
info Direct dependencies
└─ element-ui@2.15.13
info All dependencies
├─ async-validator@1.8.5
├─ babel-helper-vue-jsx-merge-props@2.0.3
├─ babel-runtime@6.26.0
├─ element-ui@2.15.13
├─ normalize-wheel@1.0.1
├─ regenerator-runtime@0.11.1
├─ resize-observer-polyfill@1.5.1
└─ throttle-debounce@1.1.0
Done in 26.77s.
  • 添加 element-plus 组件
E:\java\idea_java_maven\vue_fileuploaddemo>yarn add element-plus
yarn add v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > element-ui@2.15.13" has incorrect peer dependency "vue@^2.5.17".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 18 new dependencies.
info Direct dependencies
└─ element-plus@2.3.4
info All dependencies
├─ @ctrl/tinycolor@3.6.0
├─ @element-plus/icons-vue@2.1.0
├─ @floating-ui/core@1.2.6
├─ @floating-ui/dom@1.2.8
├─ @popperjs/core@2.11.7
├─ @types/lodash-es@4.17.7
├─ @types/lodash@4.14.194
├─ @types/web-bluetooth@0.0.16
├─ @vueuse/core@9.13.0
├─ @vueuse/metadata@9.13.0
├─ @vueuse/shared@9.13.0
├─ async-validator@4.2.5
├─ dayjs@1.11.7
├─ element-plus@2.3.4
├─ lodash-es@4.17.21
├─ lodash-unified@1.0.3
├─ memoize-one@6.0.0
└─ normalize-wheel-es@1.2.0
Done in 44.53s.
  • 还要添加 axios 组件和 vue-axios 但是因为没有记录
  • 命令
yarn add axios
yarn add vue-axios
  • 注意这里是 add 而 不是 install
E:\java\idea_java_maven\vue_fileuploaddemo>yarn add  axios
E:\java\idea_java_maven\vue_fileuploaddemo>yarn add vue-axios
  • 在 main.js 中添加
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus';
import 'element-plus/theme-chalk/index.css';
import locale from 'element-plus/lib/locale/lang/zh-cn'
import 'element-ui/lib/theme-chalk/index.css';createApp(App).use(router).use(ElementPlus, { locale }).mount('#app')
  • 新使用 yarn 来管理包
  • 安装 依赖包
yarn install
  • 编译和热加载用于开发
  • 命令行启动项目
yarn serve
  • 编译和最小化产品
  • 输出 可用的index.html 项目
yarn build
主要代码
  • 使用 element-ui 来创建页面的部分
<div class="UploadFile" style="border:solid blue 1px;"><el-upload class="upload-demo" action="http://127.0.0.1:14852/file/uploadandownload" :on-preview="upload"accept=".jpg" :limit="10"><!--   回调函数--><el-button size="small" type="primary">点击上传</el-button><div class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div></el-upload>
</div>
// 回调函数
methods: {upload(file) {alert("文件上传.........");alert(file.response.url);const url = file.response.url;window.open(url);}

后端

  • 使用 idea 创建 springboot 项目
  • 配置 application.yml
spring:servlet:multipart:max-file-size:100MBapplication:name: SpringbootFileUploadDemodatasource:type: com.alibaba.druid.pool.DruidDataSourcedriver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3307/FileUploadDemo?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=trueusername: rootpassword: admin
server:port: 14852undertow:io-threads: 16worker-threads: 256buffer-size: 1024buffers-per-region: 1024direct-buffers: trueservlet:context-path: /
mybatis:mapper-locations: classpath:mapper/*.xmltype-aliases-package: com.codervibe.springbootfileuploaddemo.model# 日志
logging:level:# 将 包 内 设置为 info # mapper 包 中设置为 debugroot: infocom.codervibe.springbootfileuploaddemo: infocom.codervibe.springbootfileuploaddemo.mapper: debugfile:path: ./log
  • 配置 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 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.2.6.RELEASE</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.codervibe</groupId><artifactId>SpringbootFileUploadDemo</artifactId><version>0.0.1-SNAPSHOT</version><name>SpringbootFileUploadDemo</name><description>SpringbootFileUploadDemo</description><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></properties><dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.11</version><scope>test</scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.1.2</version></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.22</version><scope>provided</scope></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.28</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.1.21</version></dependency><dependency><groupId>org.junit.jupiter</groupId><artifactId>junit-jupiter</artifactId></dependency><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><!-- 排除Tomcat依赖 --><exclusions><exclusion><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-tomcat</artifactId></exclusion></exclusions></dependency><!-- 添加 Undertow依赖 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-undertow</artifactId></dependency></dependencies><build><finalName>Springboot_FileUploadDemo</finalName><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
  • 创建返回的 Response
package com.codervibe.springbootfileuploaddemo.model;/*** @author Administrator*/
public class Resp <E>{private String code;private String message;private E body;public Resp(String code, String message, E body) {this.code = code;this.message = message;this.body = body;}public String getCode() {return code;}public void setCode(String code) {this.code = code;}public String getMessage() {return message;}public void setMessage(String message) {this.message = message;}public E getBody() {return body;}public void setBody(E body) {this.body = body;}// 成功的时候 返回值为200public static <E> Resp<E> success(E body){return new Resp<>("200","",body);}// 失败的时候 返回值由调用的时候指定public static <E> Resp<E> fail(String code,String message){return new Resp<>(code,message,null);}
}
  • 上传文件的接口
package com.codervibe.springbootfileuploaddemo.controller;import com.codervibe.springbootfileuploaddemo.model.Resp;
import com.codervibe.springbootfileuploaddemo.service.FileUploadService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;/*** @author Administrator* 文件上传接口*/
@RestController
@CrossOrigin
@RequestMapping(value = "/file")
public class FileUploadController {@Resourceprivate FileUploadService fileUploadService;private Log log = LogFactory.getLog(this.getClass());private SimpleDateFormat timeFormat = new SimpleDateFormat("yyyyMMddHHmmss");@RequestMapping(value = "/upload", method = RequestMethod.POST)private Resp<String> upload(@RequestParam("file") MultipartFile file) {log.info("上传文件 方法 执行");return fileUploadService.fileUpload(file);}//实际上这只是 上传之后 显示文件内容 并没有办法下载@RequestMapping(value = "/uploadandownload", method = RequestMethod.POST)private Map<String,Object> uploadandownload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {// 这里的大部分内容应该写在 service 层的实现中log.info("上传下载 文件 方法 执行");Map<String,Object> result =new HashMap<>();String originalFilename = file.getOriginalFilename();String 当前时间 = timeFormat.format(new Date());String realPath = request.getServletContext().getRealPath("/") + 当前时间;log.info("realPath = "+realPath);File folder =new File(realPath);if (!folder.exists()) {folder.mkdirs();}String newName = UUID.randomUUID()+"."+originalFilename.substring(originalFilename.lastIndexOf(".") + 1);log.info("newName = "+newName);File realfile =new File(folder,newName);try {file.transferTo(realfile);String url = request.getScheme()+"://"+request.getServerName() + ":"+request.getServerPort() +"/"+当前时间 + newName;log.info("url="+url);result.put("code",200);result.put("url",url);}catch (IOException e) {result.put("code",400);result.put("message",e.getMessage());}boolean fileExists = realfile.exists();if (fileExists) {log.info("文件存在 文件保存成功");} else {log.warn("文件不存在 文件保存失败!");}return  result;}
}
  • service层 接口 以及 service 接口的 实现
  • service层 接口
package com.codervibe.springbootfileuploaddemo.service;import com.codervibe.springbootfileuploaddemo.model.Resp;
import org.springframework.web.multipart.MultipartFile;/*** @author Administrator*/
public interface FileUploadService {/*** 文件上传*/Resp<String> fileUpload(MultipartFile file);
}
  • service 接口 实现
package com.codervibe.springbootfileuploaddemo.service.Impl;import com.codervibe.springbootfileuploaddemo.model.Resp;
import com.codervibe.springbootfileuploaddemo.service.FileUploadService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;/*** @author Administrator*/
@Service
public class FileUploadServiceImpl implements FileUploadService {Log log = LogFactory.getLog(this.getClass());SimpleDateFormat timeFormatForSendingMail = new SimpleDateFormat("yyyyMMddHHmmss");/*** 文件上传*/@Overridepublic Resp<String> fileUpload(MultipartFile file) {log.info("文件上传服务.......");if (file.isEmpty()) {return Resp.fail("400", "文件为空");}String OriginalFileName = file.getOriginalFilename();String 当前时间 = timeFormatForSendingMail.format(new Date());log.info("当前时间: "+当前时间);log.info("原本的文件名:"+ OriginalFileName);String 文件名 =  OriginalFileName.substring(0,OriginalFileName.indexOf("."));String fileName = 当前时间 + 文件名 +"."+ OriginalFileName.substring(OriginalFileName.lastIndexOf(".") + 1);// 存储的位置写死了 如果要修改 还要重新编译 就有些麻烦String filePath = "C:\\Users\\Default\\AppData\\Local\\FileUploadDemo\\";log.info("filePath" + filePath);log.info("保存的文件名:"+ 文件名);log.info("文件保存位置:" + filePath + fileName);File newFile = new File(filePath + fileName);if (!newFile.getParentFile().exists()) {newFile.getParentFile().mkdirs();}try {file.transferTo(newFile);} catch (Exception e) {e.printStackTrace();return Resp.fail("500",OriginalFileName + "上传失败");}boolean fileExists = newFile.exists();if (fileExists) {log.info("文件存在 文件保存成功");} else {log.warn("文件不存在 文件保存失败!");}return Resp.success(fileName);}
}

前端项目地址 https://github.com/codervibe/vue_fileuploaddemo.git
后端项目地址 https://github.com/codervibe/SpringbootFileUploadDemo.git

相关文章:

Vue + Springboot 文件上传项目笔记(一)

Vue Springboot 文件上传项目笔记&#xff08;一&#xff09; 前端 使用脚手架创建项目 vue create vue_fileuploaddemo等待命令执行完毕添加 element-ui 组件 E:\java\idea_java_maven\vue_fileuploaddemo>yarn add element-ui yarn add v1.22.19 [1/4] Resolving pac…...

【华为OD机试真题2023B卷 JAVA】座位调整

华为OD2023(B卷)机试题库全覆盖,刷题指南点这里 座位调整 知识点迭代 时间限制:1s 空间限制:256MB 限定语言:C(clang11), C++(clang++11), Java(javac 1.8), Python3(3.9), JavaScript Node(12.18.2), Go(1.14.4) 题目描述: 疫情期间课堂的座位进行了特殊的调整,不能出…...

Python 学习 2022.08.28 周日

文章目录 一、 概述1.1&#xff09; 之前写的文章&#xff1a;1.2) 基础点1.3) 配置1.4) Python2 和 Python3 的区别1.5&#xff09; 相关问题跟踪解决1.6) 其他 一、 概述 1.1&#xff09; 之前写的文章&#xff1a; 【Python大系】Python快速教程《Python 数据库 GUI CGI编…...

WEB自动化测试,一定得掌握的8个核心知识点

​ 编辑 写在前面 使用 cypress 进行端对端测试&#xff0c;和其他的一些框架有一个显著不同的地方&#xff0c;它使用 JavaScript 作为编程语言。 传统主流的 selenium 框架是支持多语言的&#xff0c;大多数 QA 会的 python 和 Java 语言都可以编写 selenium 代码&#xff0…...

期末复习总结!!【MySQL】库和表的基本操作 + 增删改查CURD

文章目录 前言一、数据库的基本操作1, 查看库2, 创建库3, 使用库4, 删除库 二、表的基本操作1, 创建表2, 查看表3, 查看表结构4, 删除表 三、增加(Create)四、查询(Retrieve) (重点)1, 全列查询2, 指定列查询3, 查询字段为表达式4, 指定别名5, 去重6, 排序7, 条件查询7.1, 基本…...

线上问题处理案例:出乎意料的数据库连接池 | 京东云技术团队

导读 本文是线上问题处理案例系列之一&#xff0c;旨在通过真实案例向读者介绍发现问题、定位问题、解决问题的方法。本文讲述了从垃圾回收耗时过长的表象&#xff0c;逐步定位到数据库连接池保活问题的全过程&#xff0c;并对其中用到的一些知识点进行了总结。 一、问题描述…...

有了 IP 地址,为什么还要用 MAC 地址?

MAC地址等价于快递包裹上的收件人姓名。 MAC地址更多是用于确认对方信息而存在的。就如同快递跨越几个城市来到你面前&#xff0c;快递员需要和你确认一下收件人是否正确&#xff0c;才会把包裹交给你一样。 IP66在线查IP地址位置&#xff1a;https://www.ip66.net/?utm-sour…...

ChatGPT 推出 iOS 应用,支持语音输入,使用体验如何?

最近&#xff0c;OpenAI 宣布推出官方 iOS 应用&#xff0c;允许用户随时随地访问其高人气 AI 聊天机器人&#xff0c;此举也打破了近几个月内苹果 App Store 上充斥似是而非的山寨服务的窘境。 该应用程序是 ChatGPT 的首个官方移动应用程序。ChatGPT 软件程序在去年推出后迅速…...

【科普】干货!带你从0了解移动机器人(二)—— 移动机器人硬件组成

移动机器人是一个多功能于一体的综合系统&#xff0c;内容涵盖了传感器技术、自动化技术、信息处理、电子工程等&#xff0c;它集环境感知、动态决策与规划于一体&#xff0c;是目前科学技术发展最活跃的领域之一。移动机器人的各种组件之间需要协同工作才能实现机器人的自主移…...

WIN提权 令牌窃取进程注入

令牌窃取&#xff08;鸡肋玩意 2008包括2008以下&#xff09; 令牌&#xff0c;又叫token&#xff0c;是系统临时产生的秘钥&#xff0c;相当于账号密码&#xff0c;用来决定是否允许此次请求和判断此次请求是属于哪一个用户。 win7一下的版本可以尝试 这里使用msf上自带的令…...

CSS 提高性能的方法,并提供一些实用的技巧和代码示例

CSS 是前端开发中不可或缺的一部分&#xff0c;它负责网页的样式和布局。随着网站规模和复杂度的增加&#xff0c;CSS 的性能也变得越来越重要。本文将介绍 CSS 提高性能的方法&#xff0c;并提供一些实用的技巧和代码示例。 使用压缩后的 CSS 文件 压缩 CSS 文件可以减小文件…...

程序员:面试造火箭,入职拧螺丝?太难了···

刚开始工作的时候&#xff0c;我也想不通这个问题&#xff0c;甚至很鄙视这种现象。后面当了面试官&#xff0c;做到了公司中层管理&#xff0c;也会站在公司以及行业角度去重新思考这个问题。 为什么这种现象会越来越普遍呢&#xff1f;尤其在 IT 行业愈加明显。 面试看的是…...

pg事务:隔离级别历史与SSI

事务隔离级别的历史 ANSI SQL-92定义的隔离级别和异常现象确实对数据库行业影响深远&#xff0c;甚至30年后的今天&#xff0c;绝大部分工程师对事务隔离级别的概念还停留在此&#xff0c;甚至很多真实的数据库隔离级别实现也停留在此。但后ANSI92时代对事物隔离有许多讨论甚至…...

【滑动窗口】【单调队列】个人练习-Leetcode-2373. Largest Local Values in a Matrix

题目链接&#xff1a;https://leetcode.cn/problems/largest-local-values-in-a-matrix/ 题目大意&#xff1a;给出一个N*N矩阵&#xff0c;要求做池化操作&#xff0c;选出每个3*3矩阵的最大值&#xff0c;返回一个(N-2)*(N-2)矩阵 思路&#xff1a;这是个简单题&#xff0c…...

工厂蓝牙定位技术的原理、应用场景、优势及潜在问题

蓝牙定位技术是近年来在工业领域中得到广泛应用的一项技术。随着工业自动化的快速发展和物联网技术的普及&#xff0c;工厂蓝牙定位成为了提高生产效率、优化生产流程和管理的重要工具。本文将详细介绍工厂蓝牙定位技术的原理、应用场景以及其在工业生产中的优势。 首先&#x…...

Linux内核模块编程

访问【WRITE-BUG数字空间】_[内附完整源码和文档] 1 总体设计思路 Linux内核是单体式结构&#xff0c;相对于微内核结构而言&#xff0c;其运行效率高&#xff0c;但是系统的可维护性和可扩展性较差。为此&#xff0c;Linux提供了内核模块&#xff08;module&#xff09;机制&…...

每日一练 | 网络工程师软考真题 Day8

1、某客户端采用ping命令检测网络连接故障时&#xff0c;发现可以ping通127.0.0.1及本机的IP地址&#xff0c;但无法ping通同一网段内其他工作正常的计算机的IP地址。该客户端的故障可能是 。 A&#xff0e;TCP/IP协议不能正常工作 B&#xff0e;本机网卡不能正常工作 …...

springBoot如何【禁用Swagger】

需求&#xff1a; 生产环境下&#xff0c;需要关闭swagger配置&#xff0c;避免接口暴露。 方法&#xff1a; 1、使用注解Value() 2、使用注解Profile({“dev”,“test”}) 表示在开发或测试环境开启&#xff0c;而在生产关闭。 3、使用注解ConditionalOnProperty(name “s…...

​数据库原理及应用上机(实验四 SQL连接查询)

✨作者&#xff1a;命运之光 ✨专栏&#xff1a;数据库原理及应用上机实验 目录 ✨一、实验目的和要求 ✨二、实验内容及步骤 ✨三&#xff0e;实验结果 ✨四、实验总结 &#x1f353;&#x1f353;前言&#xff1a; 数据库原理及应用上机实验报告的一个简单整理后期还会不…...

linux上使用系统安装和Docker安装mysql的两种方式

一、安装到linux 1、安装mysql-server 1、在安装之前查看下系统是否已经安装了mysql ls /usr/share2、安装mysql-server sudo apt-get install mysql-server3、再次查看&#xff0c;发现多了个mysql ls /usr/share | grep mysql //在ls打印结果中搜索mysql关键字4、登陆 在…...

线程同步:确保多线程程序的安全与高效!

全文目录&#xff1a; 开篇语前序前言第一部分&#xff1a;线程同步的概念与问题1.1 线程同步的概念1.2 线程同步的问题1.3 线程同步的解决方案 第二部分&#xff1a;synchronized关键字的使用2.1 使用 synchronized修饰方法2.2 使用 synchronized修饰代码块 第三部分&#xff…...

定时器任务——若依源码分析

分析util包下面的工具类schedule utils&#xff1a; ScheduleUtils 是若依中用于与 Quartz 框架交互的工具类&#xff0c;封装了定时任务的 创建、更新、暂停、删除等核心逻辑。 createScheduleJob createScheduleJob 用于将任务注册到 Quartz&#xff0c;先构建任务的 JobD…...

从零开始打造 OpenSTLinux 6.6 Yocto 系统(基于STM32CubeMX)(九)

设备树移植 和uboot设备树修改的内容同步到kernel将设备树stm32mp157d-stm32mp157daa1-mx.dts复制到内核源码目录下 源码修改及编译 修改arch/arm/boot/dts/st/Makefile&#xff0c;新增设备树编译 stm32mp157f-ev1-m4-examples.dtb \stm32mp157d-stm32mp157daa1-mx.dtb修改…...

让AI看见世界:MCP协议与服务器的工作原理

让AI看见世界&#xff1a;MCP协议与服务器的工作原理 MCP&#xff08;Model Context Protocol&#xff09;是一种创新的通信协议&#xff0c;旨在让大型语言模型能够安全、高效地与外部资源进行交互。在AI技术快速发展的今天&#xff0c;MCP正成为连接AI与现实世界的重要桥梁。…...

均衡后的SNRSINR

本文主要摘自参考文献中的前两篇&#xff0c;相关文献中经常会出现MIMO检测后的SINR不过一直没有找到相关数学推到过程&#xff0c;其中文献[1]中给出了相关原理在此仅做记录。 1. 系统模型 复信道模型 n t n_t nt​ 根发送天线&#xff0c; n r n_r nr​ 根接收天线的 MIMO 系…...

IP如何挑?2025年海外专线IP如何购买?

你花了时间和预算买了IP&#xff0c;结果IP质量不佳&#xff0c;项目效率低下不说&#xff0c;还可能带来莫名的网络问题&#xff0c;是不是太闹心了&#xff1f;尤其是在面对海外专线IP时&#xff0c;到底怎么才能买到适合自己的呢&#xff1f;所以&#xff0c;挑IP绝对是个技…...

08. C#入门系列【类的基本概念】:开启编程世界的奇妙冒险

C#入门系列【类的基本概念】&#xff1a;开启编程世界的奇妙冒险 嘿&#xff0c;各位编程小白探险家&#xff01;欢迎来到 C# 的奇幻大陆&#xff01;今天咱们要深入探索这片大陆上至关重要的 “建筑”—— 类&#xff01;别害怕&#xff0c;跟着我&#xff0c;保准让你轻松搞…...

Web中间件--tomcat学习

Web中间件–tomcat Java虚拟机详解 什么是JAVA虚拟机 Java虚拟机是一个抽象的计算机&#xff0c;它可以执行Java字节码。Java虚拟机是Java平台的一部分&#xff0c;Java平台由Java语言、Java API和Java虚拟机组成。Java虚拟机的主要作用是将Java字节码转换为机器代码&#x…...

NPOI Excel用OLE对象的形式插入文件附件以及插入图片

static void Main(string[] args) {XlsWithObjData();Console.WriteLine("输出完成"); }static void XlsWithObjData() {// 创建工作簿和单元格,只有HSSFWorkbook,XSSFWorkbook不可以HSSFWorkbook workbook new HSSFWorkbook();HSSFSheet sheet (HSSFSheet)workboo…...

java高级——高阶函数、如何定义一个函数式接口类似stream流的filter

java高级——高阶函数、stream流 前情提要文章介绍一、函数伊始1.1 合格的函数1.2 有形的函数2. 函数对象2.1 函数对象——行为参数化2.2 函数对象——延迟执行 二、 函数编程语法1. 函数对象表现形式1.1 Lambda表达式1.2 方法引用&#xff08;Math::max&#xff09; 2 函数接口…...