当前位置: 首页 > 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、登陆 在…...

基于大模型的 UI 自动化系统

基于大模型的 UI 自动化系统 下面是一个完整的 Python 系统,利用大模型实现智能 UI 自动化,结合计算机视觉和自然语言处理技术,实现"看屏操作"的能力。 系统架构设计 #mermaid-svg-2gn2GRvh5WCP2ktF {font-family:"trebuchet ms",verdana,arial,sans-…...

应用升级/灾备测试时使用guarantee 闪回点迅速回退

1.场景 应用要升级,当升级失败时,数据库回退到升级前. 要测试系统,测试完成后,数据库要回退到测试前。 相对于RMAN恢复需要很长时间&#xff0c; 数据库闪回只需要几分钟。 2.技术实现 数据库设置 2个db_recovery参数 创建guarantee闪回点&#xff0c;不需要开启数据库闪回。…...

Zustand 状态管理库:极简而强大的解决方案

Zustand 是一个轻量级、快速和可扩展的状态管理库&#xff0c;特别适合 React 应用。它以简洁的 API 和高效的性能解决了 Redux 等状态管理方案中的繁琐问题。 核心优势对比 基本使用指南 1. 创建 Store // store.js import create from zustandconst useStore create((set)…...

django filter 统计数量 按属性去重

在Django中&#xff0c;如果你想要根据某个属性对查询集进行去重并统计数量&#xff0c;你可以使用values()方法配合annotate()方法来实现。这里有两种常见的方法来完成这个需求&#xff1a; 方法1&#xff1a;使用annotate()和Count 假设你有一个模型Item&#xff0c;并且你想…...

高等数学(下)题型笔记(八)空间解析几何与向量代数

目录 0 前言 1 向量的点乘 1.1 基本公式 1.2 例题 2 向量的叉乘 2.1 基础知识 2.2 例题 3 空间平面方程 3.1 基础知识 3.2 例题 4 空间直线方程 4.1 基础知识 4.2 例题 5 旋转曲面及其方程 5.1 基础知识 5.2 例题 6 空间曲面的法线与切平面 6.1 基础知识 6.2…...

Kafka主题运维全指南:从基础配置到故障处理

#作者&#xff1a;张桐瑞 文章目录 主题日常管理1. 修改主题分区。2. 修改主题级别参数。3. 变更副本数。4. 修改主题限速。5.主题分区迁移。6. 常见主题错误处理常见错误1&#xff1a;主题删除失败。常见错误2&#xff1a;__consumer_offsets占用太多的磁盘。 主题日常管理 …...

深度学习之模型压缩三驾马车:模型剪枝、模型量化、知识蒸馏

一、引言 在深度学习中&#xff0c;我们训练出的神经网络往往非常庞大&#xff08;比如像 ResNet、YOLOv8、Vision Transformer&#xff09;&#xff0c;虽然精度很高&#xff0c;但“太重”了&#xff0c;运行起来很慢&#xff0c;占用内存大&#xff0c;不适合部署到手机、摄…...

k8s从入门到放弃之HPA控制器

k8s从入门到放弃之HPA控制器 Kubernetes中的Horizontal Pod Autoscaler (HPA)控制器是一种用于自动扩展部署、副本集或复制控制器中Pod数量的机制。它可以根据观察到的CPU利用率&#xff08;或其他自定义指标&#xff09;来调整这些对象的规模&#xff0c;从而帮助应用程序在负…...

人工智能 - 在Dify、Coze、n8n、FastGPT和RAGFlow之间做出技术选型

在Dify、Coze、n8n、FastGPT和RAGFlow之间做出技术选型。这些平台各有侧重&#xff0c;适用场景差异显著。下面我将从核心功能定位、典型应用场景、真实体验痛点、选型决策关键点进行拆解&#xff0c;并提供具体场景下的推荐方案。 一、核心功能定位速览 平台核心定位技术栈亮…...

React从基础入门到高级实战:React 实战项目 - 项目五:微前端与模块化架构

React 实战项目&#xff1a;微前端与模块化架构 欢迎来到 React 开发教程专栏 的第 30 篇&#xff01;在前 29 篇文章中&#xff0c;我们从 React 的基础概念逐步深入到高级技巧&#xff0c;涵盖了组件设计、状态管理、路由配置、性能优化和企业级应用等核心内容。这一次&…...