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

配置文件生成器-秒杀SSM的xml整合

配置文件生成器-秒杀SSM的xml整合

在这里插入图片描述

思路: 通过简单的配置,直接生成对应配置文件。

maven坐标

  <dependencies><!--    配置文件生成    --><dependency><groupId>org.freemarker</groupId><artifactId>freemarker</artifactId><version>2.3.31</version></dependency><!--数据库驱动--><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.27</version></dependency><!--数据库连接池--><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.2.1</version></dependency><!--    jspapi--><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.2</version></dependency><!--      jstl标签库  --><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version></dependency><!--Mybatis--><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.5.2</version></dependency><!--mybatis、spring整合--><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>2.0.6</version></dependency><!--Springmvc--><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>5.2.12.RELEASE</version></dependency><!--    mvc、实体类序列化成json。默认jackson    --><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.12.5</version></dependency><!--    lombok插件    --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.30</version><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>5.1.9.RELEASE</version></dependency></dependencies><build><!--  必选:生成ssm配置文件时,务必把以下内容注释  。项目运行过程mybatis如果报错,再打开、否则保留注释即可。 --><!--        <resources>--><!--            &lt;!&ndash;  静态资源过滤问题解决&ndash;&gt;--><!--            <resource>--><!--                <directory>src/main/java</directory>--><!--                <includes>--><!--                    <include>**/*.properties</include>--><!--                    <include>**/*.xml</include>--><!--                </includes>--><!--                <filtering>false</filtering>--><!--            </resource>--><!--            <resource>--><!--                <directory>src/main/resources</directory>--><!--                <includes>--><!--                    <include>**/*.properties</include>--><!--                    <include>**/*.xml</include>--><!--                </includes>--><!--                <filtering>false</filtering>--><!--            </resource>--><!--        </resources>--></build>

一、生成器ftl模板文件

模板文件,全部放在resource目录下的template文件夹中 。

  • mybatis-config-template.ftl 模板文件。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN""http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration><settings><!-- 打印sql日志 --><setting name="logImpl" value="STDOUT_LOGGING" /></settings><!-- 设置别名 --><typeAliases><package name="${packageName}"/></typeAliases><!-- 其他的MyBatis配置 --></configuration>
  • springmvc-config-template.xml.ftl 模板文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:mvc="http://www.springframework.org/schema/mvc"xmlns:context="http://www.springframework.org/schema/context"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd"><!-- 配置Controller包扫描 --><context:component-scan base-package="${basePackage}"/><!-- 配置视图解析器 --><bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"><property name="prefix" value="${viewResolverPrefix}"/><property name="suffix" value="${viewResolverSuffix}"/></bean><!--配置静态资源的访问映射,此配置中的文件,将不被前端控制器拦截 --><mvc:resources location="/static/" mapping="/static/**" /><!-- 开启SpringMVC的注解 --><mvc:annotation-driven/></beans>
  • spring-mybatis-config-template.ftl 模板文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd"><!-- 扫描dao和service包 --><context:component-scan base-package="${basePackage}"/><!-- 数据源配置,根据实际数据库连接信息修改 --><bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"><property name="driverClassName" value="${dbDriverClassName}"/><property name="url" value="${dbUrl}"/><property name="username" value="${dbUsername}"/><property name="password" value="${dbPassword}"/></bean><!-- MyBatis的SqlSessionFactory配置 --><bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><property name="dataSource" ref="dataSource"/><property name="mapperLocations" value="${mapperLocations}"/><!--注入mybatis配置文件--><property name="configLocation" value="${mybatisConfigLocation}"/></bean><!-- MyBatis的MapperScannerConfigurer配置 --><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="basePackage" value="${daoBasePackage}"/><property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/></bean><!-- 事务管理器配置 --><bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource"/></bean></beans>
  • web-config-template.ftl 模板文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"><!-- Spring的核心监听器 --><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><!-- Spring的核心配置文件 --><context-param><param-name>contextConfigLocation</param-name><param-value>${springMyBatisConfigPath}</param-value></context-param><!-- Spring MVC的DispatcherServlet --><servlet><servlet-name>DispatcherServlet</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><param-value>${springMvcConfigPath}</param-value></init-param><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>DispatcherServlet</servlet-name><url-pattern>/</url-pattern></servlet-mapping><!-- 其他的Web配置 --><!-- 添加UTF-8编码的全局过滤器 --><filter><filter-name>encodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param><init-param><param-name>forceEncoding</param-name><param-value>true</param-value></init-param></filter><filter-mapping><filter-name>encodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping></web-app>

二、生成器代码

import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/*** 最屌Java实习生  -chen fei* 2023/10/6*/
public class SSMWebXmlGenerator {// SSM 全局参数private static final String BASE_PACKAGE = "com.itheima";private static final String OUTPUT_DIR = "src/main/resources/ssm";  // 配置文件生成目录// MyBatis 配置参数private static final String MYBATIS_CONFIG_LOCATIONS = "classpath:ssm/mybatis-config.xml";private static final String MYBATIS_OUTPUT_PATH = OUTPUT_DIR + "/mybatis-config.xml";  // 设置mybaits配置文件名字private static final String POJO_PACKAGE = BASE_PACKAGE + ".pojo"; // typeAliases  设置别名参数// Spring MVC 配置参数private static final String SPRING_MVC_OUTPUT_PATH = OUTPUT_DIR + "/springmvc-config.xml";  //springmvc配置文件名字private static final String CONTROLLER_PACKAGE = BASE_PACKAGE + ".controller";   // 配置controller包位置,以便可以扫描到里面的beanprivate static final String VIEW_RESOLVER_PREFIX = "/WEB-INF/jsp/";  //视图解析器前缀private static final String VIEW_RESOLVER_SUFFIX = ".jsp";//视图解析器后缀// Spring 配置参数private static final String SPRING_OUTPUT_PATH = OUTPUT_DIR + "/spring-mybatis-config.xml";  //spring配置文件名字private static final String DAO_PACKAGE = BASE_PACKAGE + ".dao";  // dao层的全包名private static final String SERVICE_PACKAGE = BASE_PACKAGE + ".service";  //service层的全包名private static final String DB_DRIVER_CLASS_NAME = "com.mysql.cj.jdbc.Driver"; //mysql驱动,默认8.*private static final String DB_URL = "jdbc:mysql://localhost:3306/cnmsb";  //urlprivate static final String DB_USERNAME = "root"; //账号private static final String DB_PASSWORD = "root"; // 密码private static final String MYBATIS_MAPPER_LOCATIONS = "classpath*:mapper/*.xml"; //配置mybatis中xml的位置// web.xml 配置参数private static final String WEB_XML_OUTPUT_PATH = "src/main/webapp/WEB-INF/web.xml";   //生成路径private static final String SPRING_MYBATIS_CONFIG_PATH = "classpath:ssm/spring-mybatis-config.xml";  //spring配置文件名private static final String SPRING_MVC_CONFIG_PATH = "classpath:ssm/springmvc-config.xml"; //springmvc文件名public static void main(String[] args) throws IOException, TemplateException {try {
//            先生成所需目录createDirectoriesIfNotExists();
//            生成mybaits配置文件generateMyBatisConfig();
//            mvc配置文件generateSpringMVCConfig();
//            spring配置文件generateSpringConfig();
//            web.xml配置文件。generateWebXml();} catch (IOException | TemplateException e) {e.printStackTrace();System.err.println("生成配置文件时出错:" + e.getMessage());System.out.println("请注意,生成配置文件时、请删除或注释pom文件中,build标签。会影响生成!!!");}}private static void createDirectoriesIfNotExists() {// Create base package directoriesString[] subPackages = {"pojo", "dao", "service", "controller", "utils"};for (String subPackage : subPackages) {String packagePath = BASE_PACKAGE.replace('.', '/') + "/" + subPackage;File packageDir = new File("src/main/java/" + packagePath);if (!packageDir.exists()) {if (packageDir.mkdirs()) {System.out.println("Created package directory: " + packagePath);} else {System.err.println("Failed to create package directory: " + packagePath);}}}// Check and create VIEW_RESOLVER_PREFIX directoryFile viewResolverDir = new File("src/main/webapp" + VIEW_RESOLVER_PREFIX);if (!viewResolverDir.exists()) {if (viewResolverDir.mkdirs()) {System.out.println("Created VIEW_RESOLVER_PREFIX directory: " + viewResolverDir.getPath());} else {System.err.println("Failed to create VIEW_RESOLVER_PREFIX directory: " + viewResolverDir.getPath());}}// Check and create 'mapper' directory in resourcesFile resourcesDir = new File("src/main/resources");File mapperDir = new File(resourcesDir, "mapper");if (!mapperDir.exists()) {if (mapperDir.mkdirs()) {System.out.println("Created 'mapper' directory in resources.");} else {System.err.println("Failed to create 'mapper' directory in resources.");}}File resourcesDir2 = new File("src/main/resources");File mapperDir2 = new File(resourcesDir2, "static");if (!mapperDir2.exists()) {if (mapperDir2.mkdirs()) {System.out.println("Created 'static' directory in resources.");} else {System.err.println("Failed to create 'static' directory in resources.");}}}private static void generateMyBatisConfig() throws IOException, TemplateException {// 配置 FreeMarkerConfiguration configuration = new Configuration(Configuration.VERSION_2_3_31);configuration.setClassForTemplateLoading(SSMWebXmlGenerator.class, "/");configuration.setDefaultEncoding("UTF-8");// 加载 MyBatis 配置模板文件Template template = configuration.getTemplate("template/mybatis-config-template.ftl");Map<String, String> dataModel = new HashMap<>();// 设置 MyBatis 包名参数dataModel.put("packageName", POJO_PACKAGE);generateFile(MYBATIS_OUTPUT_PATH, template, dataModel);}private static void generateSpringMVCConfig() throws IOException, TemplateException {// 配置 FreeMarkerConfiguration configuration = new Configuration(Configuration.VERSION_2_3_31);configuration.setClassForTemplateLoading(SSMWebXmlGenerator.class, "/");configuration.setDefaultEncoding("UTF-8");// 加载 Spring MVC 配置模板文件Template template = configuration.getTemplate("template/springmvc-config-template.xml.ftl");Map<String, String> dataModel = new HashMap<>();// 设置 Spring MVC 包名参数和视图解析器参数dataModel.put("basePackage", CONTROLLER_PACKAGE);dataModel.put("viewResolverPrefix", VIEW_RESOLVER_PREFIX);dataModel.put("viewResolverSuffix", VIEW_RESOLVER_SUFFIX);generateFile(SPRING_MVC_OUTPUT_PATH, template, dataModel);}private static void generateSpringConfig() throws IOException, TemplateException {// 配置 FreeMarkerConfiguration configuration = new Configuration(Configuration.VERSION_2_3_31);configuration.setClassForTemplateLoading(SSMWebXmlGenerator.class, "/");configuration.setDefaultEncoding("UTF-8");// 加载 Spring 配置模板文件Template template = configuration.getTemplate("template/spring-mybatis-config-template.ftl");Map<String, String> dataModel = new HashMap<>();// 设置 Spring 包名参数和数据库连接参数dataModel.put("basePackage", DAO_PACKAGE + "," + SERVICE_PACKAGE);dataModel.put("dbDriverClassName", DB_DRIVER_CLASS_NAME);dataModel.put("dbUrl", DB_URL);dataModel.put("dbUsername", DB_USERNAME);dataModel.put("dbPassword", DB_PASSWORD);dataModel.put("mapperLocations", MYBATIS_MAPPER_LOCATIONS);dataModel.put("mybatisConfigLocation", MYBATIS_CONFIG_LOCATIONS);dataModel.put("daoBasePackage", DAO_PACKAGE);generateFile(SPRING_OUTPUT_PATH, template, dataModel);}private static void generateWebXml() throws IOException, TemplateException {// 配置 FreeMarkerConfiguration configuration = new Configuration(Configuration.VERSION_2_3_31);configuration.setClassForTemplateLoading(SSMWebXmlGenerator.class, "/");configuration.setDefaultEncoding("UTF-8");// 加载 web.xml 配置模板文件Template template = configuration.getTemplate("template/web-config-template.ftl");Map<String, String> dataModel = new HashMap<>();// 设置 web.xml 配置参数,引用之前生成的配置文件路径dataModel.put("springMyBatisConfigPath", SPRING_MYBATIS_CONFIG_PATH);dataModel.put("springMvcConfigPath", SPRING_MVC_CONFIG_PATH);generateFile(WEB_XML_OUTPUT_PATH, template, dataModel);}private static Configuration createConfiguration() {// 创建 FreeMarker 配置Configuration configuration = new Configuration(Configuration.VERSION_2_3_31);configuration.setClassForTemplateLoading(SSMWebXmlGenerator.class, "/");configuration.setDefaultEncoding("UTF-8");return configuration;}private static void generateFile(String outputPath, Template template, Map<String, String> dataModel)throws IOException, TemplateException {// 检查父目录是否存在,如果不存在则创建File parentDir = new File(outputPath).getParentFile();if (!parentDir.exists()) {parentDir.mkdirs();}// 写入文件FileWriter writer = new FileWriter(new File(outputPath));template.process(dataModel, writer);writer.close();System.out.println("配置文件生成成功:" + outputPath);}
}

相关文章:

配置文件生成器-秒杀SSM的xml整合

配置文件生成器-秒杀SSM的xml整合 思路&#xff1a; 通过简单的配置&#xff0c;直接生成对应配置文件。 maven坐标 <dependencies><!-- 配置文件生成 --><dependency><groupId>org.freemarker</groupId><artifactId>freemarker<…...

小黑开始了拉歌训练,第一次进入部室馆,被通知要去当主持人心里有些紧张的leetcode之旅:337. 打家劫舍 III

小黑代码&#xff08;小黑卡在了bug中&#xff0c;上午一步步探索做出&#xff0c;非常NB!!!&#xff09; # Definition for a binary tree node. # class TreeNode: # def __init__(self, val0, leftNone, rightNone): # self.val val # self.left lef…...

flutter开发实战-inappwebview实现flutter与Javascript方法调用

flutter开发实战-inappwebview实现flutter与Javascript方法调用 在使用inappwebview时候&#xff0c;需要flutter端与JS进行交互&#xff0c;调用相应的方法&#xff0c;在inappwebview中的JavaScript Handlers。 一、JavaScript Handlers 要添加JavaScript Handlers&#…...

alsa pcm设备之硬件参数

硬件参数包含了stream描述比如格式,采样率,通道数,和ringbuffer 圆形缓存区大小等. 使用snd_pcm_hw_params_t ,ALSA pcm设备使用了参数重定义系统相关的硬件参数,应用程序首先选择全范围的配置, 然后应用程序设置单个参数,直到所有参数都是基本的(确定的). 格式 量化位數&#…...

websocket拦截

python实现websocket拦截 前言一、拦截的优缺点优点缺点二、实现方法1.环境配置2.代码三、总结现在的直播间都是走的websocket通信,想要获取websocket通信的内容就需要使用websocket拦截,大多数是使用中间人代理进行拦截,这里将会使用更简单的方式进行拦截。 前言 开发者工…...

深度强化学习之 PPO 算法

深度强化学习之 PPO 算法 强化学习原理学习策略 基于行为价值 & 基于行为概率策略梯度算法&#xff1a;计算状态下所有行为的概率演员 - 评论家算法&#xff1a;一半基于行为价值&#xff0c;一半基于行为概率DQN 算法&#xff08;深度Q网络&#xff09;Q-Learning&#x…...

iPhone升级iOS17出现无法连接互联网的错误提示怎么办?

最新的iOS 17系统已经发布了快一个月了&#xff0c;很多人都已升级体验更多全新功能&#xff0c;但有部分用户却在升级过程中遇到一些问题&#xff1a;如无法验证更新&#xff0c;iOS17验证失败&#xff0c;因为您不再连接到互联网、 iPhone无法检查更新等错误问题。明明网络稳…...

Spring:处理@Autowired和@Value注解的BeanPostProcessor

AutowiredAnnotationBeanPostProcessor,它实现了MergedBeanDefinitionPostProcessor,因此会调用postProcessMergedBeanDefinition方法。 它实现了InstantiationAwareBeanPostProcessor,因此在属性注入时会调用postProcessPropertyValues方法 如果Autowired注解按类型找到了大…...

极坐标系下的交换积分次序

极坐标系下的交换积分次序 我把极坐标系下的交换积分次序总结为动静与静动之间的转换&#xff0c;下面通过一个例子感受一下 ρ 1 、 ρ 1 cos ⁡ θ \rho1、\rho1\cos\theta ρ1、ρ1cosθ ∫ 0 π / 2 d θ ∫ 1 1 cos ⁡ θ f ( ρ cos ⁡ θ , ρ sin ⁡ θ ) ρ d…...

MySQL命令行中文乱码问题

MySQL命令行中文乱码问题&#xff1a; 命令行界面默认字符集是gbk&#xff0c;若字符集不匹配会中文乱码或无法插入中文。 解决办法&#xff1a;执行set names gbk; 验证&#xff1a; 执行命令show variables like ‘char%’;查看默认字符集。 创建数据库设置字符集utf8&…...

图论---图的遍历

在图论中&#xff0c;图的遍历一般有两种&#xff0c;分别为DFS&#xff08;深度优先遍历&#xff09;、BFS&#xff08;广度优先遍历&#xff09;&#xff0c;以下是这两种遍历方式的模板&#xff1a; DFS&#xff08;深度优先搜索&#xff09; 代码框架&#xff1a; void …...

AM@无穷小和无穷大

文章目录 abstract本文符号说明无穷小无穷小和自变量变化过程无穷小和函数极限的关系定理&#x1f47a;证明 无穷大无穷大不是数极限无穷大的说法证明函数极限为无穷大 无穷大和无穷小见的关系定理无穷小无穷大的运算法则 abstract 无穷小和无穷大的概念和相关性质 本文符号说…...

玄子Share- IDEA 2023 SpringBoot 热部署

玄子Share- IDEA 2023 SpringBoot 热部署 修改 IDEA 部署设置 IDEA 勾选如下选项 新建 SpringBoot 项目 项目构建慢的将 Spring Initializr 服务器 URL 改为阿里云&#xff1a;https://start.aliyun.com/ 在这里直接勾选Spring Boot Devtools插件即可 测试 切出 IDEA 项目文…...

kafka集群工作机制

一、kafka在zookeeper上的元数据解释 kafka中的broker要选举Controller角色来管理整个kafka集群中的分区和副本状态。一个Topic下多个partition要选举Leader角色和客户端进行交互数据 Zookeeper客户端工具&#xff1a; prettyZoo。 下载地址&#xff1a;https://github.com/vr…...

JVM上篇之虚拟机与java虚拟机介绍

目录 虚拟机 java虚拟机 简介 特点 作用 位置 整体结构 类装载子系统 运行时数据区 java执行引擎 Java代码执行流程 jvm架构模型 基于栈式架构 基于寄存器架构 总结 jvm的生命周期 1.启动 2.执行 3.退出 JVM的发展历程 虚拟机 所谓虚拟机&#xff0c;指的…...

在公众号上怎么创建微信付费课程功能呢

微信付费课程功能是一项比较受欢迎的在线教育服务&#xff0c;可以帮助教育机构或个人更好地管理和销售课程资源&#xff0c;提高知识分享和变现的效率。下面将介绍如何创建微信付费课程功能。 一、了解微信付费课程功能 在创建微信付费课程功能之前&#xff0c;需要先了解微信…...

HTML5使用html2canvas转化为图片,然后再转为base64.

介绍 场景&#xff1a;今天同事提了个协助&#xff0c;将HTML5文件中的元素转为图片&#xff0c;并且最终转为base64格式传给后端。感觉还挺有意思就记录下。&#xff08;试例如下&#xff09; 步骤一&#xff1a;引入html2canvas 的js源码 html2canvas.min.js 下载地址 htt…...

【C++设计模式之原型模式:创建型】分析及示例

简介 原型模式&#xff08;Prototype Pattern&#xff09;是一种创建型设计模式&#xff0c;它允许通过复制已有对象来生成新的对象&#xff0c;而无需再次使用构造函数。 描述 原型模式通过复制现有对象来创建新的对象&#xff0c;而无需显式地调用构造函数或暴露对象的创建…...

TDengine OSS 与 qStudio 实现无缝协同,革新数据分析和管理方式

在数字化转型如火如荼的当下&#xff0c;海量爆发的时序数据处理成为转型成功的关键因素之一。为了帮助社区用户更好地进行数据分析和管理&#xff0c;丰富可视化解决方案的多样性&#xff0c;我们将开源的时序数据库&#xff08;Time Series Database&#xff09; TDengine OS…...

css的gap设置元素之间的间隔

在felx布局中可以使用gap来设置元素之间的间隔&#xff1b; .box{width: 800px;height: auto;border: 1px solid green;display: flex;flex-wrap: wrap;gap: 100px; } .inner{width: 200px;height: 200px;background-color: skyblue; } <div class"box"><…...

多云管理“拦路虎”:深入解析网络互联、身份同步与成本可视化的技术复杂度​

一、引言&#xff1a;多云环境的技术复杂性本质​​ 企业采用多云策略已从技术选型升维至生存刚需。当业务系统分散部署在多个云平台时&#xff0c;​​基础设施的技术债呈现指数级积累​​。网络连接、身份认证、成本管理这三大核心挑战相互嵌套&#xff1a;跨云网络构建数据…...

树莓派超全系列教程文档--(61)树莓派摄像头高级使用方法

树莓派摄像头高级使用方法 配置通过调谐文件来调整相机行为 使用多个摄像头安装 libcam 和 rpicam-apps依赖关系开发包 文章来源&#xff1a; http://raspberry.dns8844.cn/documentation 原文网址 配置 大多数用例自动工作&#xff0c;无需更改相机配置。但是&#xff0c;一…...

SciencePlots——绘制论文中的图片

文章目录 安装一、风格二、1 资源 安装 # 安装最新版 pip install githttps://github.com/garrettj403/SciencePlots.git# 安装稳定版 pip install SciencePlots一、风格 简单好用的深度学习论文绘图专用工具包–Science Plot 二、 1 资源 论文绘图神器来了&#xff1a;一行…...

在鸿蒙HarmonyOS 5中实现抖音风格的点赞功能

下面我将详细介绍如何使用HarmonyOS SDK在HarmonyOS 5中实现类似抖音的点赞功能&#xff0c;包括动画效果、数据同步和交互优化。 1. 基础点赞功能实现 1.1 创建数据模型 // VideoModel.ets export class VideoModel {id: string "";title: string ""…...

Swift 协议扩展精进之路:解决 CoreData 托管实体子类的类型不匹配问题(下)

概述 在 Swift 开发语言中&#xff0c;各位秃头小码农们可以充分利用语法本身所带来的便利去劈荆斩棘。我们还可以恣意利用泛型、协议关联类型和协议扩展来进一步简化和优化我们复杂的代码需求。 不过&#xff0c;在涉及到多个子类派生于基类进行多态模拟的场景下&#xff0c;…...

【大模型RAG】Docker 一键部署 Milvus 完整攻略

本文概要 Milvus 2.5 Stand-alone 版可通过 Docker 在几分钟内完成安装&#xff1b;只需暴露 19530&#xff08;gRPC&#xff09;与 9091&#xff08;HTTP/WebUI&#xff09;两个端口&#xff0c;即可让本地电脑通过 PyMilvus 或浏览器访问远程 Linux 服务器上的 Milvus。下面…...

srs linux

下载编译运行 git clone https:///ossrs/srs.git ./configure --h265on make 编译完成后即可启动SRS # 启动 ./objs/srs -c conf/srs.conf # 查看日志 tail -n 30 -f ./objs/srs.log 开放端口 默认RTMP接收推流端口是1935&#xff0c;SRS管理页面端口是8080&#xff0c;可…...

【论文笔记】若干矿井粉尘检测算法概述

总的来说&#xff0c;传统机器学习、传统机器学习与深度学习的结合、LSTM等算法所需要的数据集来源于矿井传感器测量的粉尘浓度&#xff0c;通过建立回归模型来预测未来矿井的粉尘浓度。传统机器学习算法性能易受数据中极端值的影响。YOLO等计算机视觉算法所需要的数据集来源于…...

【配置 YOLOX 用于按目录分类的图片数据集】

现在的图标点选越来越多&#xff0c;如何一步解决&#xff0c;采用 YOLOX 目标检测模式则可以轻松解决 要在 YOLOX 中使用按目录分类的图片数据集&#xff08;每个目录代表一个类别&#xff0c;目录下是该类别的所有图片&#xff09;&#xff0c;你需要进行以下配置步骤&#x…...

unix/linux,sudo,其发展历程详细时间线、由来、历史背景

sudo 的诞生和演化,本身就是一部 Unix/Linux 系统管理哲学变迁的微缩史。来,让我们拨开时间的迷雾,一同探寻 sudo 那波澜壮阔(也颇为实用主义)的发展历程。 历史背景:su的时代与困境 ( 20 世纪 70 年代 - 80 年代初) 在 sudo 出现之前,Unix 系统管理员和需要特权操作的…...