Java 書城項目本地部署指引

来源:https://www.cnblogs.com/xiqingbo/archive/2022/06/01/java-30.html
-Advertisement-
Play Games

利用 Java語言使用 SSM 框架編寫完成書城項目後本地部署步驟操作指引 ...


BookStore

部署步驟

  1. $ git clone https://gitee.com/xiqingbo/bookstore.git #將遠程倉庫克隆到本地

  2. 打開IDEA編譯器依次點擊 File - Open

    image

  3. 找到我們克隆下來的項目

    image

  4. 選中右上角的“項目結構”按鈕

    image

  5. 在“項目結構”界面,選中 “Facets” 並點擊 “+” 添加一個 "Web"

    image

  6. 選擇需要添加的模塊

    image

  7. 選擇 “Facets” 後會預設跳轉到 “Modules” 選項界面並給出提示,按照提示點擊 “Create Artifacts”

    image

  8. 點擊 “Create Artifacts”後會預設跳轉到 “Artifacts” 選項界面,可以選擇右側的 “lib” 雙擊將需要輸出的文件放入左側輸出目錄中,或根據下方提示 “Fix” 點擊 "Add 'lib' to the artifact",效果相同;最後 "Apply" 或直接 "OK" 就可以了

    image

  9. 配置 Tomcat 伺服器運行項目,點擊IDEA上方 “Add Configurations” 選項

    image

  10. 在配置界面找到 "Tomcat Server - Local"模版並選中,根據上方提示點擊 “Create configuration”

    image

  11. 自動創建配置後下方會出現警告,此時需要關聯我們之前配置好的 “Artifacts”,點擊 "Fix"

    image

  12. 點擊 "Fix" 後會關聯到我們已經配置好的 “Artifacts”,最後 "Apply" 或直接 "OK" 就可以了

    image

  13. 在資料庫管理工具中新建資料庫名固定為 bookstore,並初始化以下表及數據

    /*
     Navicat Premium Data Transfer
    
     Source Server         : localhost
     Source Server Type    : MySQL
     Source Server Version : 50727
     Source Host           : localhost:3306
     Source Schema         : bookstore
    
     Target Server Type    : MySQL
     Target Server Version : 50727
     File Encoding         : 65001
    
     Date: 19/05/2022 21:26:58
    */
    
    SET NAMES utf8mb4;
    SET FOREIGN_KEY_CHECKS = 0;
    
    -- ----------------------------
    -- Table structure for t_book
    -- ----------------------------
    DROP TABLE IF EXISTS `t_book`;
    CREATE TABLE `t_book`  (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
      `author` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
      `price` decimal(11, 2) NOT NULL,
      `sales` int(11) NOT NULL,
      `stock` int(11) NOT NULL,
      `img_path` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
      PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 30 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
    
    -- ----------------------------
    -- Records of t_book
    -- ----------------------------
    INSERT INTO `t_book` VALUES (1, 'java從入門到放棄', 'Linus Torvalds', 80.00, 9999, 9, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (2, '數據結構與演算法', 'Jeff Dean', 78.50, 6, 13, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (3, '怎樣拐跑別人的媳婦', 'John Carmack', 68.00, 100006, 45, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (4, '木虛肉蓋飯', 'Richard Stallman', 16.00, 1009, 41, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (5, 'C++編程思想', 'Fabrice Bellard', 45.50, 14, 95, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (6, '蛋炒飯', 'Doug Cutting', 9.90, 12, 53, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (7, '賭神', 'Donald Knuth', 66.50, 125, 535, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (8, 'Java編程思想', 'Anders Hejlsberg', 99.50, 47, 36, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (9, 'JavaScript從入門到精通', 'Ken Thompson', 9.90, 85, 95, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (10, 'cocos2d-x游戲編程入門', 'Adam D Angelo', 49.00, 52, 62, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (11, 'C語言程式設計', 'Sanjay Ghemawat', 28.00, 52, 74, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (12, 'Lua語言程式設計', 'Petr Mitrichev', 51.50, 48, 82, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (13, '西游記', 'Jon Skeet', 12.00, 19, 9999, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (14, '水滸傳', 'Gennady Korotkevich', 33.05, 22, 88, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (15, '操作系統原理', 'Jon Skeet', 133.05, 122, 188, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (16, '數據結構 java版', 'Gennady Korotkevich', 173.15, 21, 81, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (17, 'UNIX高級環境編程', 'Richard Stallman', 99.15, 210, 810, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (18, 'javaScript高級編程', 'Petr Mitrechev', 69.15, 210, 810, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (19, '大話設計模式', 'Doug Cutting', 89.15, 20, 10, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (20, '人月神話', 'Anders Hejlsberg', 88.15, 20, 80, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (26, '時間簡史', '霍金', 30.00, 200, 300, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (27, '修改後的數據', '作者1', 111.00, 111, 111, 'static/img/default.png');
    INSERT INTO `t_book` VALUES (29, '修改數據完成', '作者2', 3333.00, 3333, 3333, 'static/img/default.png');
    
    -- ----------------------------
    -- Table structure for t_order
    -- ----------------------------
    DROP TABLE IF EXISTS `t_order`;
    CREATE TABLE `t_order`  (
      `order_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
      `creation_time` datetime(0) NULL DEFAULT NULL,
      `price` decimal(11, 2) NULL DEFAULT NULL,
      `status` int(11) NULL DEFAULT NULL,
      `user_id` int(11) NULL DEFAULT NULL,
      PRIMARY KEY (`order_id`) USING BTREE,
      INDEX `user_id`(`user_id`) USING BTREE,
      CONSTRAINT `t_order_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `t_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
    ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
    
    -- ----------------------------
    -- Records of t_order
    -- ----------------------------
    INSERT INTO `t_order` VALUES ('16147708201621', '2021-03-03 11:27:00', 200.00, 0, 1);
    INSERT INTO `t_order` VALUES ('16147772792532', '2021-03-03 13:14:39', 242.50, 0, 2);
    INSERT INTO `t_order` VALUES ('16147776087662', '2021-03-03 13:20:09', 0.00, 0, 2);
    INSERT INTO `t_order` VALUES ('16147776113612', '2021-03-03 13:20:11', 0.00, 0, 2);
    INSERT INTO `t_order` VALUES ('16147789428202', '2021-03-03 13:42:23', 78.50, 0, 2);
    INSERT INTO `t_order` VALUES ('16147789733112', '2021-03-03 13:42:53', 16.00, 0, 2);
    INSERT INTO `t_order` VALUES ('16147802861272', '2021-03-03 14:04:46', 80.00, 0, 2);
    INSERT INTO `t_order` VALUES ('16147804192232', '2021-03-03 14:06:59', 32.00, 0, 2);
    INSERT INTO `t_order` VALUES ('16147804912532', '2021-03-03 14:08:11', 16.00, 0, 2);
    INSERT INTO `t_order` VALUES ('16147806820482', '2021-03-03 14:11:22', 68.00, 0, 2);
    INSERT INTO `t_order` VALUES ('16148151318172', '2021-03-03 23:45:32', 204.00, 0, 2);
    INSERT INTO `t_order` VALUES ('16148192562122', '2021-03-04 00:54:16', 68.00, 0, 2);
    INSERT INTO `t_order` VALUES ('16149818910862', '2021-03-05 22:04:51', 68.00, 0, 2);
    INSERT INTO `t_order` VALUES ('16521019967272', '2022-05-09 13:13:17', 84.00, 0, 2);
    INSERT INTO `t_order` VALUES ('20210303', '2021-03-03 07:55:21', 100.00, 0, 1);
    
    -- ----------------------------
    -- Table structure for t_order_item
    -- ----------------------------
    DROP TABLE IF EXISTS `t_order_item`;
    CREATE TABLE `t_order_item`  (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
      `count` int(11) NULL DEFAULT NULL,
      `price` decimal(11, 2) NULL DEFAULT NULL,
      `total_price` decimal(11, 2) NULL DEFAULT NULL,
      `order_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
      PRIMARY KEY (`id`) USING BTREE,
      INDEX `order_id`(`order_id`) USING BTREE,
      CONSTRAINT `t_order_item_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `t_order` (`order_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
    ) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
    
    -- ----------------------------
    -- Records of t_order_item
    -- ----------------------------
    INSERT INTO `t_order_item` VALUES (1, 'Java從入門到精通', 1, 50.00, 50.00, '20210303');
    INSERT INTO `t_order_item` VALUES (2, 'Java從入門到放棄', 2, 25.00, 50.00, '20210303');
    INSERT INTO `t_order_item` VALUES (3, 'Java', 1, 50.00, 50.00, '16147708201621');
    INSERT INTO `t_order_item` VALUES (4, 'C++', 1, 50.00, 50.00, '16147708201621');
    INSERT INTO `t_order_item` VALUES (5, 'C#', 2, 50.00, 100.00, '16147708201621');
    INSERT INTO `t_order_item` VALUES (6, 'java從入門到放棄', 1, 80.00, 80.00, '16147772792532');
    INSERT INTO `t_order_item` VALUES (7, '數據結構與演算法', 1, 78.50, 78.50, '16147772792532');
    INSERT INTO `t_order_item` VALUES (8, '怎樣拐跑別人的媳婦', 1, 68.00, 68.00, '16147772792532');
    INSERT INTO `t_order_item` VALUES (9, '木虛肉蓋飯', 1, 16.00, 16.00, '16147772792532');
    INSERT INTO `t_order_item` VALUES (10, '數據結構與演算法', 1, 78.50, 78.50, '16147789428202');
    INSERT INTO `t_order_item` VALUES (11, '木虛肉蓋飯', 1, 16.00, 16.00, '16147789733112');
    INSERT INTO `t_order_item` VALUES (12, '木虛肉蓋飯', 5, 16.00, 80.00, '16147802861272');
    INSERT INTO `t_order_item` VALUES (13, '木虛肉蓋飯', 2, 16.00, 32.00, '16147804192232');
    INSERT INTO `t_order_item` VALUES (14, '木虛肉蓋飯', 1, 16.00, 16.00, '16147804912532');
    INSERT INTO `t_order_item` VALUES (15, '怎樣拐跑別人的媳婦', 1, 68.00, 68.00, '16147806820482');
    INSERT INTO `t_order_item` VALUES (16, '怎樣拐跑別人的媳婦', 3, 68.00, 204.00, '16148151318172');
    INSERT INTO `t_order_item` VALUES (17, '怎樣拐跑別人的媳婦', 1, 68.00, 68.00, '16148192562122');
    INSERT INTO `t_order_item` VALUES (18, '怎樣拐跑別人的媳婦', 1, 68.00, 68.00, '16149818910862');
    INSERT INTO `t_order_item` VALUES (19, '怎樣拐跑別人的媳婦', 1, 68.00, 68.00, '16521019967272');
    INSERT INTO `t_order_item` VALUES (20, '木虛肉蓋飯', 1, 16.00, 16.00, '16521019967272');
    
    -- ----------------------------
    -- Table structure for t_user
    -- ----------------------------
    DROP TABLE IF EXISTS `t_user`;
    CREATE TABLE `t_user`  (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `username` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
      `password` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
      `mailbox` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
      PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
    
    -- ----------------------------
    -- Records of t_user
    -- ----------------------------
    INSERT INTO `t_user` VALUES (1, 'heber', 'heber', '[email protected]');
    INSERT INTO `t_user` VALUES (2, 'admin', 'admin', '[email protected]');
    INSERT INTO `t_user` VALUES (3, 'tom', 'tom', '[email protected]');
    INSERT INTO `t_user` VALUES (4, 'jackson', 'jackson', '[email protected]');
    
    SET FOREIGN_KEY_CHECKS = 1;
    
  14. 初始化數據完成後點擊 IDEA 綠色三角圖標啟動伺服器運行項目

    image

  15. 伺服器啟動成功後,就會自動彈出我們的項目頁面啦!

    image

本文來自博客園,作者:Schieber,轉載請註明原文鏈接:https://www.cnblogs.com/xiqingbo/p/java-30.html


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • undo日誌 前面學習了redo日誌,redo日誌保證的是崩潰時事務持久性。我們可以從redo日誌恢復到系統崩潰以前。 undo日誌就是為了保證事務回滾時事務所作所為都能回到事務執行前。保證了事務的原子性。redo把我們做增刪改之前的狀態記錄下來,幫助MySQL回滾到事務執行之前的樣子。 這篇文章了 ...
  • 隨著短視頻時代的到來,音視頻剪輯應用不斷增加,市場競爭愈發激烈,如何為用戶提供差異化剪輯功能和優質的音頻處理體驗,已成為行業新的挑戰。 “音頻音樂剪輯“是武漢網冪科技開發的一款手機音頻剪輯應用,支持音樂剪輯、音頻提取、伴奏人聲提取、格式轉換、手機鈴聲製作、拼接、變速、混音、錄音、降噪等功能。為了給用 ...
  • 該項目是學習Nest.js框架所得,前端基於Vue.js + Vuex + VueRouter + ElementUI + SCSS,後端基於Node.js + TypeScript + Nest.js + MySQL + TypeORM。 ...
  • 思路:通過註冊表註冊自定義URL協議執行bat腳本,將文件路徑作為參數傳入 環境:win10 前置問題與條件 問題1:可以從瀏覽器直接打開可執行文件嗎? 答:不能。其實可以通過 ActiveXObject 實現軟體直接打開,但是它是不安全的,並且現在被大多數現代瀏覽器禁止,只能在 ie 使用。而通過 ...
  • 簡單介紹一下,我的 web 前端開發技術選擇。我更偏向於使用 jQuery 及其插件、CSS3、HTML5。不喜歡 mvvm 之類的技術。 ...
  • 近幾年國內外聲名鵲起的Rust編程語言,聲名遠播,影響力巨大,到底是什麼讓它如此強大?本文適合作為一篇初級入門的文章。本文的優勢是通過一個常見的例子作為線索,引出Rust的一些重要理念或者說特性,通過這些特性深刻體會Rust的魅力。 ...
  • synchronized 是java中常見的保證多線程訪問共用資源時的安全的一個關鍵字。很多人在講到synchronized 時都說synchronized 是一把重量級的鎖,那麼synchronized 真的很重麽? synchronized 在jdk 1.6以前(不包括1.6)的確是一把很重的鎖 ...
  • Spring Ioc源碼分析系列--@Autowired註解的實現原理 前言 前面系列文章分析了一把Spring Ioc的源碼,是不是雲里霧裡,感覺並沒有跟實際開發搭上半毛錢關係?看了一遍下來,對我的提升在哪?意義何在?如果沒點收穫,那浪費時間來看這個作甚,玩玩游戲不香? 這段玩笑話可不是真的玩笑, ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...