Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use springboot integrated development to realize the second kill function of shopping malls

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "how to use springboot integrated development to achieve mall second kill function", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "how to use springboot integrated development to achieve mall second kill function" this article.

Springboot integrated development to realize the second kill of shopping mall

Join the main dependence

Org.springframework.boot spring-boot-starter-thymeleaf com.alibaba druid 1.0.5 redis.clients jedis com.alibaba fastjson 1.2.38 commons-codec commons-codec org.springframework.boot spring-boot-starter-validation org.springframework.boot spring-boot-starter-amqp com.google.guava guava 19.0

The main directory framework of the second kill project

1.java directory

Config all configuration information controllerexception all business exceptions mapperservicerabbitmqredis redis cache validator backend check bean: data transfer layer includes: mysql and redisutil: toolkit dto: data transfer object

Second kill system logic

Realize the technical point

1.MD5

Implement that the user's password is encrypted before saving to the database

two。 Unified handling of global exceptions

Handle all kinds of exceptions accordingly by intercepting all exceptions

3. Page caching

Cached into redis through manually rendered html pages

WebContext ctx = new WebContext (request, response, request.getServletContext (), request.getLocale (), model.asMap ()); html = thymeleafViewResolver.getTemplateEngine () .process ("goods_detail", ctx)

4. Solved the problem of overbought

Application.properties configuration # thymeleafspring.thymeleaf.cache=falsespring.thymeleaf.check-template=truespring.thymeleaf.check-template-location=truespring.thymeleaf.servlet.content-type=text/htmlspring.thymeleaf.enabled=truespring.thymeleaf.encoding=utf-8spring.thymeleaf.mode=HTML5spring.thymeleaf.prefix=classpath:/templates/spring.thymeleaf.suffix=.html# mybatismybatis.type-aliases-package=com.jesper.seckill.mappermybatis.configuration.map-underscore-to-camel-case=truemybatis.configuration.default-fetch-size=100mybatis.configuration.default-statement-timeout=3000mybatis.mapperLocations = classpath:com/jesper/seckill/mapper/* .xml # druidspring.datasource.url=jdbc:mysql://localhost:3306/seckill?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=UTCspring.datasource.username=rootspring.datasource.password=rootspring.datasource.driver-class-name=com.mysql.cj.jdbc.Driverspring.datasource.type=com.alibaba.druid.pool.DruidDataSourcespring.datasource.filters=statspring.datasource.maxActive=1000spring.datasource.initialSize=100spring.datasource.maxWait=60000spring.datasource.minIdle=500spring.datasource.timeBetweenEvictionRunsMillis=60000spring.datasource.minEvictableIdleTimeMillis=300000spring.datasource.validationQuery=select 'x'spring.datasource.testWhileIdle=truespring.datasource.testOnBorrow=falsespring.datasource.testOnReturn=falsespring.datasource.poolPreparedStatements=truespring.datasource .maxOpenPreparedStatements = 20cm redisdis.hoststores 127.0.0.1redis.portals 6379redis.timeoutparts 10redis.poolMaxTotalexamples 1000redis.poolMaxIdleplates 500redis.poolMaxWaitpieces 500redising.resources.addmappingstruespring.resources.cache.examples = 3600spring.resources.chain.cache=true spring.resources.chain.enabled=truespring.resources.chain.compressed=truespring.resources.chain.html-application-cache=truespring.resources.static-locations=classpath:/static/#rabbitmqspring.rabbitmq.host=127.0.0.1spring.rabbitmq.port=5672spring.rabbitmq.username=guestspring.rabbitmq.password=guestspring.rabbitmq.virtual-host=/spring.rabbitmq.listener.simple.concurrency= 10spring.rabbitmq. Listener.simple.max-concurrency= 10spring.rabbitmq.listener.simple.prefetch.prefetch.1spring.rabbitmq.listener.simple.autoCopier startupstarting truespring.rabbitmq.listener.simple.defaultMuffle requeueMuffle truespring.rabbitmq.template.retry.enabled=truespring.rabbitmq.template.retry.initial-interval=1000spring.rabbitmq.template.retry.max-attempts=3spring.rabbitmq.template.retry.max-interval=10000spring.rabbitmq.template.retry.multiplier=1.0

The above is all the contents of the article "how to use springboot integrated development to achieve the second kill function in shopping malls". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report