本文是對慕課網上"搞定SSM開發"路徑的系列課程的總結,詳細的項目文檔和課程總結放在github上了.點擊查看前端
網站售賣某產品時,規定在某個日期開始售賣限量的產品,最典型的好比小米的開售;這種狀況下,可能有不少用戶對同一產品在同一時間請求購買,併發數特別高,因此對數據庫和網絡的設計要求比較高.jquery
秒殺系統最關鍵的部分是對庫存的訪問與修改,可能存在同一時間對數據庫裏的同一字段大量的訪問,如何保證查詢的時間比較短,讓儘量多的用戶儘快訪問,是此類業務的關鍵.git
注意要多寫註釋
***github
<configuration> <!-- 配置全局屬性 --> <settings> <!-- 使用jdbc的getGeneratedKeys獲取數據庫自增主鍵 --> <setting name="useGeneratedKeys" value="true"/> <!-- 使用列別名替換列名 --> <setting name="useColumnLabel" value="true"/> <!-- 開啓駝峯命名轉換 下劃線命名到駝峯命名的轉換--> <setting name="mapUnderscoreToCamelCase" value="true"/> </settings> </configuration>
(如下序號應當從6開始)web
從"使用者"的角度設計接口:redis
使用註解的話,@Service,@Bean,@Autowired等註解實現bean的託管和依賴注入
如下爲Spring註解開啓的示例文件.spring
<?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" xmlns:aop="http://www.springframework.org/shcema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <!-- 掃描service報下全部使用註解的類型 --> <context:component-scan base-package="com.ct.maven.SecKill.service"></context:component-scan> <!-- 配置事務管理器 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <!-- 注入數據庫鏈接池 --> <property name="dataSource" ref="dataSource"></property> </bean> <tx:annotation-driven transaction-manager="transactionManager"/> </beans>
[restful] [bootStrap+jquery] [SpringMVC]sql
1:前端cdn訪問
2:redis緩存處理;
redis有windows版本可使用
3:併發訪問,經過存儲過程將一系列的操做一塊兒進行,下降由於網絡延遲致使的行級鎖數據庫