springboot-seckill
springboot-seckill copied to clipboard
:racehorse:基于SpringBoot + MySQL + Redis + RabbitMQ + Guava开发的高并发商品限时秒杀系统
> 1. 两次MD5加密 将用户输入的密码和固定Salt通过MD5加密生成第一次加密后的密码,再讲该密码和随机生成的Salt通过MD5进行第二次加密,最后将第二次加密后的密码和第一次的固定Salt存数据库 这里存到 db 的 salt 应该是第二次加密时随机生成的 salt 吧
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@117159c0: startup date [Wed Mar 23 20:50:25 CST 2022]; root of context hierarchy
检验库存>0是不是就够了
项目当前是单服务,我想了解下有没有多服务的解决方案,比如1000个秒杀商品,拆分5个服务,每个服务分配200个商品供秒杀。这个解决方案需要解决的点在于请求路由。
```code long stock = redisService.decr(GoodsKey.getGoodsStock, "" + goodsId);//10 if (stock < 0) { afterPropertiesSet(); long stock2 = redisService.decr(GoodsKey.getGoodsStock, "" + goodsId);//10 if(stock2 < 0){ localOverMap.put(goodsId, true); return Result.error(CodeMsg.SECKILL_OVER); } }...
秒杀下单时的一段代码: `//预减库存 long stock = redisService.decr(GoodsKey.getGoodsStock, "" + goodsId);//10 if (stock < 0) { afterPropertiesSet(); long stock2 = redisService.decr(GoodsKey.getGoodsStock, "" + goodsId);//10 if(stock2 < 0){ localOverMap.put(goodsId, true); return Result.error(CodeMsg.SECKILL_OVER); }...
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
秒杀已经ok,谢谢楼主
在service包里的reduceStock方法有使用GoodsVo 类的getId()方法
我看代码里面的`controller`层的`SeckillController#list()`方法,即执行秒杀的方法,redis的操作完成之后,只是把消息发送到rabbitmq中,然后rabbitmq监听取出消息,就直接和数据库交互了,所以我想问一下这个异步是体现在哪个地方呀?