基于 SSM(Spring + Spring MVC + MyBatis)框架构建电器网上订购系统
基于 SSM(Spring + Spring MVC + MyBatis)框架构建电器网上订购系统可以为用户提供一个方便快捷的购物平台。以下将详细介绍该系统的开发流程,包括需求分析、技术选型、数据库设计、项目结构搭建、主要功能实现以及前端页面设计。
需求分析
电器网上订购系统应具备以下功能:
- 用户注册与登录
- 商品展示与搜索
- 购物车管理
- 订单管理
- 支付接口集成
- 后台管理系统(商品管理、订单管理、用户管理)
技术选型
- 后端:Java、Spring、Spring MVC、MyBatis
- 前端:HTML、CSS、JavaScript、JQuery
- 数据库:MySQL
- 开发工具:IntelliJ IDEA 或 Eclipse
- 服务器:Tomcat
数据库设计
创建数据库表以存储用户信息、商品信息、购物车信息、订单信息等。
用户表(users)
id
(INT, 主键, 自增)username
(VARCHAR)password
(VARCHAR)email
(VARCHAR)phone
(VARCHAR)
商品表(products)
id
(INT, 主键, 自增)name
(VARCHAR)description
(TEXT)price
(DECIMAL)stock
(INT)category
(VARCHAR)image_url
(VARCHAR)
购物车表(cart_items)
id
(INT, 主键, 自增)user_id
(INT, 外键)product_id
(INT, 外键)quantity
(INT)
订单表(orders)
id
(INT, 主键, 自增)user_id
(INT, 外键)order_date
(DATETIME)total_price
(DECIMAL)status
(VARCHAR)
订单详情表(order_details)
id
(INT, 主键, 自增)order_id
(INT, 外键)product_id
(INT, 外键)quantity
(INT)price
(DECIMAL)
项目结构搭建
-
创建 Maven 项目
- 在 IDE 中创建一个新的 Maven 项目。
- 修改
pom.xml
文件,添加必要的依赖项。
-
配置文件
- application.properties
spring.datasource.url=jdbc:mysql://localhost:3306/electronics_store?useSSL=false&serverTimezone=UTC spring.datasource.username=root spring.datasource.password=root spring.datasource.driver-class-name=com.mysql.cj.jdbc.Drivermybatis.mapper-locations=classpath:mapper/*.xml
- spring-mvc.xml
<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"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsd"><context:component-scan base-package="com.electronics"/><mvc:annotation-driven/><bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"><property name="prefix" value="/WEB-INF/views/"/><property name="suffix" value=".jsp"/></bean></beans>
- mybatis-config.xml
<configuration><mappers><mapper resource="mapper/UserMapper.xml"/><mapper resource="mapper/ProductMapper.xml"/><mapper resource="mapper/CartItemMapper.xml"/><mapper resource="mapper/OrderMapper.xml"/><mapper resource="mapper/OrderDetailMapper.xml"/></mappers> </configuration>
- application.properties
实体类
User.java
package com.electronics.entity;public class User {private int id;private String username;private String password;private String email;private String phone;// Getters and Setters
}
Product.java
package com.electronics.entity;public class Product {private int id;private String name;private String description;private double price;private int stock;private String category;private String imageUrl;// Getters and Setters
}
CartItem.java
package com.electronics.entity;public class CartItem {private int id;private int userId;private int productId;private int quantity;// Getters and Setters
}
Order.java
package com.electronics.entity;import java.util.Date;public class Order {private int id;private int userId;private Date orderDate;private double totalPrice;private String status;// Getters and Setters
}
OrderDetail.java
package com.electronics.entity;public class OrderDetail {private int id;private int orderId;private int productId;private int quantity;private double price;// Getters and Setters
}
DAO 层
UserMapper.java
package com.electronics.mapper;import com.electronics.entity.User;
import org.apache.ibatis.annotations.*;@Mapper
public interface UserMapper {@Select("SELECT * FROM users WHERE username = #{username} AND password = #{password}")User login(@Param("username") String username, @Param("password") String password);@Insert("INSERT INTO users(username, password, email, phone) VALUES(#{username}, #{password}, #{email}, #{phone})")@Options(useGeneratedKeys = true, keyProperty = "id")void register(User user);
}
ProductMapper.java
package com.electronics.mapper;import com.electronics.entity.Product;
import org.apache.ibatis.annotations.*;import java.util.List;@Mapper
public interface ProductMapper {@Select("SELECT * FROM products")List<Product> getAllProducts();@Select("SELECT * FROM products WHERE id = #{id}")Product getProductById(int id);@Insert("INSERT INTO products(name, description, price, stock, category, image_url) VALUES(#{name}, #{description}, #{price}, #{stock}, #{category}, #{imageUrl})")@Options(useGeneratedKeys = true, keyProperty = "id")void addProduct(Product product);@Update("UPDATE products SET name=#{name}, description=#{description}, price=#{price}, stock=#{stock}, category=#{category}, image_url=#{imageUrl} WHERE id=#{id}")void updateProduct(Product product);@Delete("DELETE FROM products WHERE id=#{id}")void deleteProduct(int id);
}
CartItemMapper.java
package com.electronics.mapper;import com.electronics.entity.CartItem;
import org.apache.ibatis.annotations.*;import java.util.List;@Mapper
public interface CartItemMapper {@Select("SELECT * FROM cart_items WHERE user_id = #{userId}")List<CartItem> getCartItemsByUserId(int userId);@Insert("INSERT INTO cart_items(user_id, product_id, quantity) VALUES(#{userId}, #{productId}, #{quantity})")@Options(useGeneratedKeys = true, keyProperty = "id")void addToCart(CartItem cartItem);@Update("UPDATE cart_items SET quantity=#{quantity} WHERE id=#{id}")void updateCartItem(CartItem cartItem);@Delete("DELETE FROM cart_items WHERE id=#{id}")void deleteCartItem(int id);
}
OrderMapper.java
package com.electronics.mapper;import com.electronics.entity.Order;
import org.apache.ibatis.annotations.*;import java.util.List;@Mapper
public interface OrderMapper {@Select("SELECT * FROM orders WHERE user_id = #{userId}")List<Order> getOrdersByUserId(int userId);@Insert("INSERT INTO orders(user_id, order_date, total_price, status) VALUES(#{userId}, #{orderDate}, #{totalPrice}, #{status})")@Options(useGeneratedKeys = true, keyProperty = "id")void addOrder(Order order);@Update("UPDATE orders SET order_date=#{orderDate}, total_price=#{totalPrice}, status=#{status} WHERE id=#{id}")void updateOrder(Order order);@Delete("DELETE FROM orders WHERE id=#{id}")void deleteOrder(int id);
}
OrderDetailMapper.java
package com.electronics.mapper;import com.electronics.entity.OrderDetail;
import org.apache.ibatis.annotations.*;import java.util.List;@Mapper
public interface OrderDetailMapper {@Select("SELECT * FROM order_details WHERE order_id = #{orderId}")List<OrderDetail> getOrderDetailsByOrderId(int orderId);@Insert("INSERT INTO order_details(order_id, product_id, quantity, price) VALUES(#{orderId}, #{productId}, #{quantity}, #{price})")@Options(useGeneratedKeys = true, keyProperty = "id")void addOrderDetail(OrderDetail orderDetail);
}
Service 层
UserService.java
package com.electronics.service;import com.electronics.entity.User;
import com.electronics.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;@Service
public class UserService {@Autowiredprivate UserMapper userMapper;public User login(String username, String password) {return userMapper.login(username, password);}public void register(User user) {userMapper.register(user);}
}
ProductService.java
package com.electronics.service;import com.electronics.entity.Product;
import com.electronics.mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;@Service
public class ProductService {@Autowiredprivate ProductMapper productMapper;public List<Product> getAllProducts() {return productMapper.getAllProducts();}public Product getProductById(int id) {return productMapper.getProductById(id);}public void addProduct(Product product) {productMapper.addProduct(product);}public void updateProduct(Product product) {productMapper.updateProduct(product);}public void deleteProduct(int id) {productMapper.deleteProduct(id);}
}
CartService.java
package com.electronics.service;import com.electronics.entity.CartItem;
import com.electronics.mapper.CartItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;@Service
public class CartService {@Autowiredprivate CartItemMapper cartItemMapper;public List<CartItem> getCartItemsByUserId(int userId) {return cartItemMapper.getCartItemsByUserId(userId);}public void addToCart(CartItem cartItem) {cartItemMapper.addToCart(cartItem);}public void updateCartItem(CartItem cartItem) {cartItemMapper.updateCartItem(cartItem);}public void deleteCartItem(int id) {cartItemMapper.deleteCartItem(id);}
}
OrderService.java
package com.electronics.service;import com.electronics.entity.Order;
import com.electronics.entity.OrderDetail;
import com.electronics.mapper.OrderDetailMapper;
import com.electronics.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;@Service
public class OrderService {@Autowiredprivate OrderMapper orderMapper;@Autowiredprivate OrderDetailMapper orderDetailMapper;public List<Order> getOrdersByUserId(int userId) {return orderMapper.getOrdersByUserId(userId);}public void addOrder(Order order) {orderMapper.addOrder(order);for (OrderDetail detail : order.getOrderDetails()) {orderDetailMapper.addOrderDetail(detail);}}public void updateOrder(Order order) {orderMapper.updateOrder(order);}public void deleteOrder(int id) {orderMapper.deleteOrder(id);}
}
Controller 层
UserController.java
package com.electronics.controller;import com.electronics.entity.User;
import com.electronics.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;@Controller
public class UserController {@Autowiredprivate UserService userService;@GetMapping("/login")public String showLoginForm() {return "login";}@PostMapping("/login")public String handleLogin(@RequestParam("username") String username, @RequestParam("password") String password, Model model) {User user = userService.login(username, password);if (user != null) {model.addAttribute("user", user);return "redirect:/products";} else {model.addAttribute("error", "Invalid username or password");return "login";}}@GetMapping("/register")public String showRegisterForm() {return "register";}@PostMapping("/register")public String handleRegister(User user) {userService.register(user);return "redirect:/login";}
}
ProductController.java
package com.electronics.controller;import com.electronics.entity.Product;
import com.electronics.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;import java.util.List;@Controller
public class ProductController {@Autowiredprivate ProductService productService;@GetMapping("/products")public String showProducts(Model model) {List<Product> products = productService.getAllProducts();model.addAttribute("products", products);return "products";}@GetMapping("/product/{id}")public String showProductDetails(@RequestParam("id") int id, Model model) {Product product = productService.getProductById(id);model.addAttribute("product", product);return "productDetails";}@GetMapping("/addProduct")public String showAddProductForm() {return "addProduct";}@PostMapping("/addProduct")public String handleAddProduct(Product product) {productService.addProduct(product);return "redirect:/products";}@GetMapping("/editProduct/{id}")public String showEditProductForm(@RequestParam("id") int id, Model model) {Product product = productService.getProductById(id);model.addAttribute("product", product);return "editProduct";}@PostMapping("/editProduct")public String handleEditProduct(Product product) {productService.updateProduct(product);return "redirect:/products";}@GetMapping("/deleteProduct/{id}")public String handleDeleteProduct(@RequestParam("id") int id) {productService.deleteProduct(id);return "redirect:/products";}
}
CartController.java
package com.electronics.controller;import com.electronics.entity.CartItem;
import com.electronics.entity.Product;
import com.electronics.service.CartService;
import com.electronics.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;import java.util.List;@Controller
public class CartController {@Autowiredprivate CartService cartService;@Autowiredprivate ProductService productService;@GetMapping("/cart")public String showCart(@RequestParam("userId") int userId, Model model) {List<CartItem> cartItems = cartService.getCartItemsByUserId(userId);model.addAttribute("cartItems", cartItems);return "cart";}@PostMapping("/addToCart")public String handleAddToCart(@RequestParam("userId") int userId, @RequestParam("productId") int productId, @RequestParam("quantity") int quantity) {Product product = productService.getProductById(productId);CartItem cartItem = new CartItem();cartItem.setUserId(userId);cartItem.setProductId(productId);cartItem.setQuantity(quantity);cartService.addToCart(cartItem);return "redirect:/cart?userId=" + userId;}@PostMapping("/updateCartItem")public String handleUpdateCartItem(@RequestParam("id") int id, @RequestParam("quantity") int quantity) {CartItem cartItem = new CartItem();cartItem.setId(id);cartItem.setQuantity(quantity);cartService.updateCartItem(cartItem);return "redirect:/cart?userId=" + cartItem.getUserId();}@GetMapping("/removeFromCart/{id}")public String handleRemoveFromCart(@RequestParam("id") int id, @RequestParam("userId") int userId) {cartService.deleteCartItem(id);return "redirect:/cart?userId=" + userId;}
}
OrderController.java
package com.electronics.controller;import com.electronics.entity.Order;
import com.electronics.entity.OrderDetail;
import com.electronics.entity.Product;
import com.electronics.service.OrderService;
import com.electronics.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;import java.util.ArrayList;
import java.util.Date;
import java.util.List;@Controller
public class OrderController {@Autowiredprivate OrderService orderService;@Autowiredprivate ProductService productService;@GetMapping("/orders")public String showOrders(@RequestParam("userId") int userId, Model model) {List<Order> orders = orderService.getOrdersByUserId(userId);model.addAttribute("orders", orders);return "orders";}@PostMapping("/placeOrder")public String handlePlaceOrder(@RequestParam("userId") int userId, @RequestParam("cartItemIds") String cartItemIds) {Order order = new Order();order.setUserId(userId);order.setOrderDate(new Date());order.setTotalPrice(0.0);order.setStatus("Pending");List<OrderDetail> orderDetails = new ArrayList<>();String[] ids = cartItemIds.split(",");for (String id : ids) {int cartItemId = Integer.parseInt(id);CartItem cartItem = cartService.getCartItemById(cartItemId);Product product = productService.getProductById(cartItem.getProductId());OrderDetail orderDetail = new OrderDetail();orderDetail.setProductId(cartItem.getProductId());orderDetail.setQuantity(cartItem.getQuantity());orderDetail.setPrice(product.getPrice());orderDetails.add(orderDetail);order.setTotalPrice(order.getTotalPrice() + product.getPrice() * cartItem.getQuantity());}order.setOrderDetails(orderDetails);orderService.addOrder(order);// 清空购物车for (OrderDetail detail : orderDetails) {cartService.deleteCartItem(detail.getId());}return "redirect:/orders?userId=" + userId;}
}
前端页面
使用 JSP 创建前端页面。以下是简单的 JSP 示例:
login.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>Login</title>
</head>
<body>
<h2>Login</h2>
<form action="${pageContext.request.contextPath}/login" method="post">Username: <input type="text" name="username"><br>Password: <input type="password" name="password"><br><input type="submit" value="Login">
</form>
<c:if test="${not empty error}"><p style="color: red">${error}</p>
</c:if>
</body>
</html>
products.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head><title>Products</title>
</head>
<body>
<h2>Products</h2>
<table><tr><th>Name</th><th>Description</th><th>Price</th><th>Stock</th><th>Category</th><th>Action</th></tr><c:forEach items="${products}" var="product"><tr><td>${product.name}</td><td>${product.description}</td><td>${product.price}</td><td>${product.stock}</td><td>${product.category}</td><td><a href="${pageContext.request.contextPath}/product/${product.id}">View</a><a href="${pageContext.request.contextPath}/addToCart?userId=${user.id}&productId=${product.id}&quantity=1">Add to Cart</a></td></tr></c:forEach>
</table>
<a href="${pageContext.request.contextPath}/addProduct">Add New Product</a>
</body>
</html>
cart.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head><title>Cart</title>
</head>
<body>
<h2>Cart</h2>
<table><tr><th>Product Name</th><th>Quantity</th><th>Price</th><th>Action</th></tr><c:forEach items="${cartItems}" var="cartItem"><tr><td>${cartItem.product.name}</td><td>${cartItem.quantity}</td><td>${cartItem.product.price}</td><td><a href="${pageContext.request.contextPath}/removeFromCart?id=${cartItem.id}&userId=${user.id}">Remove</a></td></tr></c:forEach>
</table>
<a href="${pageContext.request.contextPath}/placeOrder?userId=${user.id}&cartItemIds=${cartItemIds}">Place Order</a>
</body>
</html>
测试与调试
对每个功能进行详细测试,确保所有功能都能正常工作。
部署与发布
编译最终版本的应用程序,并准备好 WAR 文件供 Tomcat 或其他应用服务器部署。
相关文章:

基于 SSM(Spring + Spring MVC + MyBatis)框架构建电器网上订购系统
基于 SSM(Spring Spring MVC MyBatis)框架构建电器网上订购系统可以为用户提供一个方便快捷的购物平台。以下将详细介绍该系统的开发流程,包括需求分析、技术选型、数据库设计、项目结构搭建、主要功能实现以及前端页面设计。 需求分析 …...

应用插件化及其进程关系梳理
插件应用的AndroidManifest.xml <manifest xmlns:android"http://schemas.android.com/apk/res/android"coreApp"true"package"com.demo.phone"android:sharedUserId"android.uid.phone"><uses-sdk android:minSdkVersion&q…...

Odoo:免费开源的医药流通行业信息化解决方案
文 / 开源智造Odoo亚太金牌服务 方案概述 开源智造Odoo免费开源ERP提供面向医药批发采、供、销业财一体化,及直接面向消费者的门店终端、全渠道管理、营销管理以及GSP合规管理解决方案,提升企业运营效率和全业务链条的数字化管控、追溯能力。 行业的最新…...

系统架构设计师论文:大数据Lambda架构
论文一:大数据Lambda架构 1简要说明你参与开发的软件项目,以及你所承担的主要工作 2 lamada体系架构将数据流分为批处理层(Batch Layer)、加速层(Speed Layer)、服务层(Serving Layer)。简要叙述这三个层次的用途和特点 3 详细阐述你参与开发的软件项目是如何基于lamada…...

亚信安全新一代WAF:抵御勒索攻击的坚固防线
近年来,勒索攻击已成为黑客的主要攻击手段。新型勒索攻击事件层出不穷,勒索攻击形势愈发严峻,已经对全球制造、金融、能源、医疗、政府组织等关键领域造成严重危害。如今,勒索攻击手段日趋成熟、攻击目标愈发明确,模式…...

Flutter 中的那些设计模式的写法(持续更新)
前言 我们都知道设计模式是相同的,同一种设计模式的理念不会因为语言不同而会有所改变,但是由于语法的差异,设计模式的写法也有所差异,本文会介绍一些flutter中常用设计模式的写法以及使用场景。 常见的设计模式有23种࿰…...

【提效工具开发】Python功能模块执行和 SQL 执行 需求整理
需求梳理 背景 当前我们在IDE或MySQL查询工具中只能进行个人使用,缺乏共享功能,且在查询及数据统计上有一定的不便。为了改善这种情况,计划搭建一个Web平台,通过后台交互来提升效率。此平台需要兼容Python工具和SQL工具的管理、执…...

Linux系列-进程的状态
🌈个人主页:羽晨同学 💫个人格言:“成为自己未来的主人~” 操作系统就是计算机领域的哲学,是为了保证在所有情况下都适用,加载到内存叫做新建状态。 并行和并发 计算机同时进行多个任务,在用户感知的…...

SpringBoot项目中常用的一些注解
一、核心注解 SpringBootApplication 作用:标注一个主程序类,表明这是一个Spring Boot应用程序的入口。说明:这是一个复合注解,组合了Configuration、EnableAutoConfiguration和ComponentScan。 EnableAutoConfiguration 作用&…...

【网络】自定义协议——序列化和反序列化
> 作者:დ旧言~ > 座右铭:松树千年终是朽,槿花一日自为荣。 > 目标:了解什么是序列化和分序列,并且自己能手撕网络版的计算器。 > 毒鸡汤:有些事情,总是不明白,所以我不…...

Pytorch如何精准记录函数运行时间
0. 引言 参考Pytorch官方文档对CUDA的描述,GPU的运算是异步执行的。一般来说,异步计算的效果对于调用者来说是不可见的,因为 每个设备按照排队的顺序执行操作Pytorch对于CPU和GPU的同步,GPU间的同步是自动执行的,不需…...

使用 Java 实现邮件发送功能
引言 1. JavaMail API 简介 2. 环境准备 2.1 Maven 依赖 2.2 Gradle 依赖 3. 发送简单文本邮件 4. 发送 HTML 邮件 5. 发送带附件的邮件 6. 注意事项 引言 在现代应用开发中,邮件发送功能是非常常见的需求,例如用户注册验证、密码重置、订单确认…...

html第一个网页
创建你的第一个HTML网页是一个激动人心的步骤。以下是创建一个简单网页的基本步骤和代码示例: 基础结构:所有的HTML文档都应该包含以下基本结构。 <!DOCTYPE html> <html> <head><title>我的第一个网页</title> </he…...

前后端交互接口(三)
前后端交互接口(三) 前言 前两集我们先做了前后端交互接口的约定以及浅浅的阅读了一些proto代码。那么这一集我们就来看看一些重要的proto代码,之后把protobuffer给引入我们的项目当中! gateway.proto 我们来看一眼我们的网关…...

华为Mate70前瞻,鸿蒙NEXT正式版蓄势待发,国产系统迎来关键一战
Mate 70系列要来了 上个月,vivo、小米、OPPO、荣耀等众多智能手机制造商纷纷发布了他们的年度旗舰产品,手机行业内竞争异常激烈。 同时,华为首席执行官余承东在其个人微博上透露,Mate 70系列将标志着华为Mate系列手机达到前所未有…...

【安卓13 源码】Input子系统(4)- InputReader 数据处理
1. 多指触控协议 多指触控协议有 2 种: > A类: 处理无关联的接触: 用于直接发送原始数据; > B类: 处理跟踪识别类的接触: 通过事件slot发送相关联的独立接触更新。 B协议可以使用一个ID来标识触点&…...

Xserver v1.4.2发布,支持自动重载 nginx 配置
Xserver——优雅、强大的 php 集成开发环境 本次更新为大家带来了更好的用户体验。 🎉 下载依赖组件时,显示进度条,展示下载进度。 🎉 保存站点信息和手动修改 vhost 配置文件之后,自动重载 nginx 配置 🐞…...

Java反射原理及其性能优化
目录 JVM是如何实现反射的反射的性能开销体现在哪里如何优化反射性能开销 1. JVM是如何实现反射的? 反射是Java语言中的一种强大功能,它允许程序在运行时动态地获取类的信息以及操作对象。下面是一个简单的示例,演示了如何使用反射调用方法ÿ…...

RabbitMQ 管理平台(控制中心)的介绍
文章目录 一、RabbitMQ 管理平台整体介绍二、Overview 总览三、Connections 连接四、Channels 通道五、Exchanges 交换机六、Queues 队列查看队列详细信息查看队列的消息内容 七、Admin 用户给用户分配虚拟主机 一、RabbitMQ 管理平台整体介绍 RabbitMQ 管理平台内有六个模块&…...

【SQL】在 SQL Server 中创建数据源是 MySQL 数据表的视图
背景:Windows系统已安装了mysql5.7和sqlServer数据库,现在需要在sqlServer创建视图或者查询来自mysql的数据,视图的数据来源mysql数据库。下面进行实现在sqlserver实现获取mysql数据表数据构建视图。 1、打开 ODBC 数据源管理器,…...

现代Web开发:Next.js 深度解析与最佳实践
💓 博客主页:瑕疵的CSDN主页 📝 Gitee主页:瑕疵的gitee主页 ⏩ 文章专栏:《热点资讯》 现代Web开发:Next.js 深度解析与最佳实践 现代Web开发:Next.js 深度解析与最佳实践 现代Web开发…...

LeetCode题练习与总结:赎金信--383
一、题目描述 给你两个字符串:ransomNote 和 magazine ,判断 ransomNote 能不能由 magazine 里面的字符构成。 如果可以,返回 true ;否则返回 false 。 magazine 中的每个字符只能在 ransomNote 中使用一次。 示例 1࿱…...

eval: jdk1.8.0_431/jre/bin/java: Permission denied
当您在启动Tomcat或其他Java应用时遇到“Permission denied”错误,这通常表示当前用户没有执行指定Java可执行文件的权限。以下是解决这个问题的几种方法: 方法一:检查文件权限 查看文件权限: 使用ls -l命令查看Java可执行文件的…...

.Net IOC理解及代码实现
IOC理解 IoC(Inversion of Control):即控制反转,这是一种设计思想,指将对象的控制权交给IOC容器,由容器来实现对象的创建、管理,程序员只需要从容器获取想要的对象就可以了。DI(Dependency Injection),即依…...

履带机器人(一、STM32控制部分--标准库)
一、履带机器人整体逻辑框架 通过在PC端搭建上位机,使得在PC端可以给STM32发送控制指令并且接受STM32的状态信息。 通过RS485通信,使得STM32可以和电机进行通信,STM32发送启动、停止、转速、方向等指令,并接受电机返回的状态信息。 二、STM32逻辑框架 整体逻辑: 1、先…...

地理空间-Java实现航迹稀释
Java实现航迹点稀释算法(Douglas - Peucker算法)的示例代码,该算法可在保证航迹整体形状变化不大的情况下减少航迹点数量: import java.util.ArrayList; import java.util.List; class Point { double x; double y; public Point…...

qt QHttpMultiPart详解
1. 概述 QHttpMultiPart是Qt框架中用于处理HTTP多部分请求的类。它类似于RFC 2046中描述的MIME multipart消息,允许在单个HTTP请求中包含多个数据部分,如文件、文本等。这种多部分请求在上传文件或发送带有附件的邮件等场景中非常有用。QHttpMultiPart类…...

【测试】【Debug】vscode中同一个测试用例出现重复
这种是正常的情况 当下面又出现一个 类似python_test->文件夹名->test_good ->test_pad 同一个测试用例出现两次,名称都相同,显然是重复了。那么如何解决? 这种情况是因为在终端利用“pip install pytest”安装 之后,又…...

Mac上的免费压缩软件-FastZip使用体验实测
FastZip是Mac上的一款免费的压缩软件,分享一下我在日常使用中的体验 压缩格式支持7Z、Zip,解压支持7Z、ZIP、RAR、TAR、GZIP、BZIP2、XZ、LZIP、ACE、ISO、CAB、PAX、JAR、AR、CPIO等所有常见格式的解压 体验使用下来能满足我所有的压缩与解压的需求&a…...

Linux(CentOS)运行 jar 包
1、在本地终端运行,关闭终端,程序就会终止 java -jar tlias-0.0.1-SNAPSHOT.jar 发送请求,成功 关闭终端(程序也会终止) 发送请求,失败 2、在远程终端运行,关闭终端,程序就会终止 …...