張素芹 王鑫



摘要:隨著微信用戶量快速增長,微信公眾號穩(wěn)定的商城構(gòu)建銜接越發(fā)重要,尤其是面對從公眾號帶來的大量引流,網(wǎng)站要考慮其運行能力、反應(yīng)速度、數(shù)據(jù)承載量等問題。本文研究的“仙鄉(xiāng)”微信商城,從商城網(wǎng)站的構(gòu)建及搭載公眾號的思路出發(fā),以大流量負荷下網(wǎng)頁穩(wěn)定為基礎(chǔ),采用String構(gòu)架,數(shù)據(jù)庫選擇MySQL,可以達到應(yīng)對多用戶多數(shù)據(jù)的情況。
Abstract: With the rapid growth of WeChat users, the stable construction of the WeChat public account is becoming more and more important, especially in the face of massive drainage from the public number. The website should consider its operational capabilities, response speed, and data carrying capacity. The "Xianxiang" WeChat Mall researched in this paper starts from the construction of the mall website and the idea of carrying the public number. Based on the stability of the webpage under the heavy traffic load, the String framework is used, and the database selects MySQL, which can cope with the situation of multi-user and multi-data.
關(guān)鍵詞:輕量級String結(jié)構(gòu);MVC結(jié)構(gòu)優(yōu)化;MySQL;JAVA Eclipse
Key words: lightweight String structure;MVC structure optimization;MySQL;JAVA Eclipse
中圖分類號:TP311? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?文獻標識碼:A? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 文章編號:1006-4311(2019)31-0214-02
0? 引言
“仙鄉(xiāng)”商城利用高度靈活的輕量級框架Spring,在Eclipse中利用Java語言開發(fā),HTML進行頁面靜態(tài)布局,數(shù)據(jù)庫采用MYSQL。在過程中實現(xiàn)了商城會員登錄、聯(lián)系客服、添加商品、商品分類、查詢物流、退款等。本文主要介紹實現(xiàn)過程中的優(yōu)化。
1? Spring框架結(jié)構(gòu)
1.1 結(jié)構(gòu)組成
Spring容器提供了IOC(控制反轉(zhuǎn))來創(chuàng)建與維護對象的方式,處理對象當中的依賴關(guān)系。與此同時,提供了AOP(面向切面編程方式)功能,聲明式事務(wù)控制處理(原子性 一致性 持久性 隔離性)。對JDBC進行了輕量級的封裝,提供了MVC設(shè)計模式的解決方案(Spring MVC)。Spring作為輕量級組件,可以將其部分組件單獨使用。見圖1和表1。
1.2 框架聯(lián)系
Spring核心容器通過控制反轉(zhuǎn)(IOC),通過容器來控制對象的創(chuàng)建及維護,對象中成員變量的創(chuàng)建及維護。反轉(zhuǎn)是將對象的控制權(quán)轉(zhuǎn)移給容器處理,是為了獲得更好的擴展性和可維護性。
對象創(chuàng)建及維護方式:
public class Con{
private Waiter Waiter;
public Waiter getWaiter() {
return Waiter;
}
public void setWaiter(Waiter waiter) {
this.Waiter = waiter;
}
}
public class Waiter{
private String waiterName;
public String getWaiterName() {
return waiterName;
}
public void setWaiterName(String waiterName) {