# 购物秒杀 **Repository Path**: itgjee/shopping_seconds ## Basic Information - **Project Name**: 购物秒杀 - **Description**: SSM 购物秒杀项目 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2019-02-15 - **Last Updated**: 2021-04-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 《JAVA高并发-秒杀商品》 项目中使用了流行的框架组合SpringMVC+Spring+MyBatis 1. 创建maven web项目 项目采用 springmvc + spring + MyBatis框架 2. 设置 servlet3.0 web.xml 2.3默认关闭el 到Tomcat8.0 apache-tomcat-8.0.52\webapps\manager 下找web.xml copy 3. 使用 junit 4.11 4. 所有依赖 junit junit 4.11 test javax.servlet jstl 1.2 log4j log4j 1.2.17 mysql mysql-connector-java 5.1.30 com.mchange c3p0 0.9.5 org.mybatis mybatis 3.3.0 org.mybatis mybatis-spring 1.2.3 com.google.code.gson gson 2.5 org.springframework spring-core ${spring.version} org.springframework spring-aop ${spring.version} org.springframework spring-jdbc ${spring.version} org.springframework spring-tx ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-test ${spring.version} 5. 完成entity 的两个类 6. 完成DAO 接口 7. 基于myBatis 实现DAO 建立mybatis-config.xml 官网查询 http://www.mybatis.org/mybatis-3/zh/getting-started.html 8. spring+ mybatis 整合,让你不用写实现类 ,爽 写spring-dao.xml 9.写 junit 测试 dao 接口 测试Seckill queryById(long seckillId) 方法是正常 测试 下面方法是报错,原因是java编译器 queryAll(arg0,arg1) 会搞不清哪个参数是哪个了 List queryAll(int offset,int limit); 加上注解就没有坑了 List queryAll(@Param("offset") int offset,@Param("limit") int limit); DAO 接口里方法,返回值是对象的,一定要设置resultType ,例如 10.开始构建服务层 service包,exception,dto等 11. spring ioc service层 依赖管理 spring-service.xml 12 配置声明式事务 @Service SeckillServiceImpl @Transactional 需要事务的方法上() 13 WEB 层设计 ,分析前端流程 14 设计 Restful 接口 (目前流行的路径),什么是Restfull 规范 Redis 改造,优化 安装教程,下载 http://www.runoob.com/redis/redis-install.html 优化点1 暴露商品秒杀地址,需要高并发支持 ,加缓存 加 dao.cache.RedisDao 序列化性能查询 https://github.com/eishay/jvm-serializers/wiki 最好的 protostuff (GOOGLE) ,所有不用java自己的序列化Serialize io.protostuff protostuff-core 1.1.0 test io.protostuff protostuff-runtime 1.1.0 测试 Redis get,put