配置文件生成器-秒杀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>--><!-- <!– 静态资源过滤问题解决–>--><!-- <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整合 思路: 通过简单的配置,直接生成对应配置文件。 maven坐标 <dependencies><!-- 配置文件生成 --><dependency><groupId>org.freemarker</groupId><artifactId>freemarker<…...

小黑开始了拉歌训练,第一次进入部室馆,被通知要去当主持人心里有些紧张的leetcode之旅:337. 打家劫舍 III
小黑代码(小黑卡在了bug中,上午一步步探索做出,非常NB!!!) # 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时候,需要flutter端与JS进行交互,调用相应的方法,在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 算法 强化学习原理学习策略 基于行为价值 & 基于行为概率策略梯度算法:计算状态下所有行为的概率演员 - 评论家算法:一半基于行为价值,一半基于行为概率DQN 算法(深度Q网络)Q-Learning&#x…...

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

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

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

MySQL命令行中文乱码问题
MySQL命令行中文乱码问题: 命令行界面默认字符集是gbk,若字符集不匹配会中文乱码或无法插入中文。 解决办法:执行set names gbk; 验证: 执行命令show variables like ‘char%’;查看默认字符集。 创建数据库设置字符集utf8&…...
图论---图的遍历
在图论中,图的遍历一般有两种,分别为DFS(深度优先遍历)、BFS(广度优先遍历),以下是这两种遍历方式的模板: DFS(深度优先搜索) 代码框架: void …...
AM@无穷小和无穷大
文章目录 abstract本文符号说明无穷小无穷小和自变量变化过程无穷小和函数极限的关系定理👺证明 无穷大无穷大不是数极限无穷大的说法证明函数极限为无穷大 无穷大和无穷小见的关系定理无穷小无穷大的运算法则 abstract 无穷小和无穷大的概念和相关性质 本文符号说…...

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

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

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

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

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

【C++设计模式之原型模式:创建型】分析及示例
简介 原型模式(Prototype Pattern)是一种创建型设计模式,它允许通过复制已有对象来生成新的对象,而无需再次使用构造函数。 描述 原型模式通过复制现有对象来创建新的对象,而无需显式地调用构造函数或暴露对象的创建…...

TDengine OSS 与 qStudio 实现无缝协同,革新数据分析和管理方式
在数字化转型如火如荼的当下,海量爆发的时序数据处理成为转型成功的关键因素之一。为了帮助社区用户更好地进行数据分析和管理,丰富可视化解决方案的多样性,我们将开源的时序数据库(Time Series Database) TDengine OS…...

css的gap设置元素之间的间隔
在felx布局中可以使用gap来设置元素之间的间隔; .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"><…...

网络六边形受到攻击
大家读完觉得有帮助记得关注和点赞!!! 抽象 现代智能交通系统 (ITS) 的一个关键要求是能够以安全、可靠和匿名的方式从互联车辆和移动设备收集地理参考数据。Nexagon 协议建立在 IETF 定位器/ID 分离协议 (…...

【kafka】Golang实现分布式Masscan任务调度系统
要求: 输出两个程序,一个命令行程序(命令行参数用flag)和一个服务端程序。 命令行程序支持通过命令行参数配置下发IP或IP段、端口、扫描带宽,然后将消息推送到kafka里面。 服务端程序: 从kafka消费者接收…...

python打卡day49
知识点回顾: 通道注意力模块复习空间注意力模块CBAM的定义 作业:尝试对今天的模型检查参数数目,并用tensorboard查看训练过程 import torch import torch.nn as nn# 定义通道注意力 class ChannelAttention(nn.Module):def __init__(self,…...
《Playwright:微软的自动化测试工具详解》
Playwright 简介:声明内容来自网络,将内容拼接整理出来的文档 Playwright 是微软开发的自动化测试工具,支持 Chrome、Firefox、Safari 等主流浏览器,提供多语言 API(Python、JavaScript、Java、.NET)。它的特点包括&a…...

关于iview组件中使用 table , 绑定序号分页后序号从1开始的解决方案
问题描述:iview使用table 中type: "index",分页之后 ,索引还是从1开始,试过绑定后台返回数据的id, 这种方法可行,就是后台返回数据的每个页面id都不完全是按照从1开始的升序,因此百度了下,找到了…...
c++ 面试题(1)-----深度优先搜索(DFS)实现
操作系统:ubuntu22.04 IDE:Visual Studio Code 编程语言:C11 题目描述 地上有一个 m 行 n 列的方格,从坐标 [0,0] 起始。一个机器人可以从某一格移动到上下左右四个格子,但不能进入行坐标和列坐标的数位之和大于 k 的格子。 例…...

SpringBoot+uniapp 的 Champion 俱乐部微信小程序设计与实现,论文初版实现
摘要 本论文旨在设计并实现基于 SpringBoot 和 uniapp 的 Champion 俱乐部微信小程序,以满足俱乐部线上活动推广、会员管理、社交互动等需求。通过 SpringBoot 搭建后端服务,提供稳定高效的数据处理与业务逻辑支持;利用 uniapp 实现跨平台前…...

Psychopy音频的使用
Psychopy音频的使用 本文主要解决以下问题: 指定音频引擎与设备;播放音频文件 本文所使用的环境: Python3.10 numpy2.2.6 psychopy2025.1.1 psychtoolbox3.0.19.14 一、音频配置 Psychopy文档链接为Sound - for audio playback — Psy…...

多种风格导航菜单 HTML 实现(附源码)
下面我将为您展示 6 种不同风格的导航菜单实现,每种都包含完整 HTML、CSS 和 JavaScript 代码。 1. 简约水平导航栏 <!DOCTYPE html> <html lang"zh-CN"> <head><meta charset"UTF-8"><meta name"viewport&qu…...
Android Bitmap治理全解析:从加载优化到泄漏防控的全生命周期管理
引言 Bitmap(位图)是Android应用内存占用的“头号杀手”。一张1080P(1920x1080)的图片以ARGB_8888格式加载时,内存占用高达8MB(192010804字节)。据统计,超过60%的应用OOM崩溃与Bitm…...