SSM 項目從搭建爬坑到 CentOS 服務器部署 - 速查手冊


SSM 項目從搭建爬坑到 CentOS 服務器部署 - 速查手冊

提示:

(1)CSDN 博客左邊有操作工具條上有文章目錄
(2)SSM 指 Spring,Spring MVC,MyBatis

Maven 的 pom.xml 配置合集

提示: 如果想查看當前最新版本,可以拷貝 xml 注解中的鏈接

基礎配置:

fastjson 1.2.54
spring-webmvc 5.1.4
spring-jdbc 5.1.4
mybatis 3.4.6
mybatis-spring 1.3.2
mysql-connector-java 8.0.13

    <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>fastjson</artifactId>
      <version>1.2.54</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>5.1.4.RELEASE</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>5.1.4.RELEASE</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>3.4.6</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis-spring</artifactId>
      <version>1.3.2</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.13</version>
    </dependency>

其他擴展:

javax.servlet-api 4.0.1
commons-email 1.5
commons-fileupload 1.4
druid 1.1.12
junit 4.11

<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-email -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-email</artifactId>
            <version>1.5</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.4</version>
        </dependency>
    <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>    

SSM 項目搭建

(1)按照博客詳細操作(含查詢實例):

(2)使用我的 Github 模板(含查詢實例):

CentOS 雲服務器環境搭建

(1)CentOS 雲服務器從購買到 JDK,Tomcat 及 MySQL 安裝及環境配置

(2)CentOS 雲服務器安裝 MySQL 8.0 及使用(所有的坑我走了一遍)

(3)xftp 介紹與安裝步驟(提供安裝包)

(4)XShell 6 中文破解版安裝(免費提供安裝包)

CentOS 雲服務器上部署 SSM 項目

(1)數據庫復制(建議使用 Navicat 12 可以直接連接),如果是在本機的數據庫需要連接服務器的數據庫進行同樣的搭建,轉出 SQL,在服務器新建數據庫,運行 SQL

(2)將 resources 中 jdbc.url 中的 localhost 改成服務器公網 ip

(3)將項目打包成 war 的形式,拷貝到 Tomcat 根目錄/webapps 目錄下

提示:

  • war 不需要解壓,Tomcat 在運行時會自動檢測,自動解壓。Tomcat 運行的時候部署 war 時不能刪除 war 包,會同時刪除。
  • 如果不想要 war 包,可以先關閉 Tomcat,再拷貝進去,手動解壓
  • war 的名稱可以修改,但是在訪問的時候要用新改名稱的作為路徑

(4)訪問路徑(自動匹配 index.html 的方式):

http://公網ip:8080/war包解壓后的目錄名/

加載自定義包下的 Mapper.xml 文件的一些問題

MyBatis 實現模糊查詢 *Mapper.xml 的幾種配置方式

JAVA 實現 QQ 郵箱發送驗證碼功能

Java 后台實現 發送手機短信的功能(中國網建)

IDEA 項目部署運行后,彈框:Windows找不到文件 'C:\Users\Administrator...Chrome.ink'

IDEA 中讀取 properties 文件中文亂碼

IDEA Maven 項目中 dependencies 紅色波浪線

IDEA 項目 web.xml 中 Servlet 配置紅色波浪線報錯:cannot resolve servlet 'springmvc'

Linux 下 MySQL 8.0 忘記密碼找回流程(8.0 版本沒有 password)

PyCharm & IDEA & WebStorm 通用激活破解方法(2019更新)

一鍵加入 QQ 技術朋友群


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM