教你使用idea搭建ssm詳細(xì)教程(Spring+Spring Mvc+Mybatis)
一、創(chuàng)建maven項(xiàng)目
我使用的是漢化的idea
可以選擇原型,我這里沒有選擇

輸入項(xiàng)目名稱,完成創(chuàng)建

二、配置tomcat
選擇運(yùn)行編輯配置

點(diǎn)加號(hào)找見tomcat,點(diǎn)擊確定

三、添加web模塊
點(diǎn)擊文件進(jìn)入項(xiàng)目結(jié)構(gòu),選擇模塊

點(diǎn)加號(hào)找見web,點(diǎn)擊確定

四、添加工件
點(diǎn)擊加號(hào)添加,并將可用元素中的jar包,右擊,加入lib中

五、為項(xiàng)目添加tomcat的jar包
選擇模塊,選擇項(xiàng)目名

選擇web服務(wù)

六、idea不會(huì)編譯src下的mapper.xml文件
讓idea編譯器不忽略src下的mapper.xml配置文件,自動(dòng)會(huì)忽略,而sts不會(huì)
在pom文件中加入以下代碼就好
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
七、將Spring和Mybatis文件位置
放在resources下

八、pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>Poject_Stu</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<!--讓idea編譯器不忽略src下的mapper.xml配置文件,自動(dòng)會(huì)忽略,而sts不會(huì)-->
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
<dependencies>
<!-- spring jar 包-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.18.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
<!-- mysql 的驅(qū)動(dòng)包-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.17</version>
</dependency>
<!--logback 日志包-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<!-- mybatis jar 包-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.2</version>
</dependency>
<!-- 數(shù)據(jù)庫(kù)連接池 alibaba 的 druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.3</version>
</dependency>
<!-- mybatis與spring整合的jar包-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.6</version>
</dependency>
<!--spring管理的 jdbc ,以及事務(wù)相關(guān)的-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
到此這篇關(guān)于教你使用idea搭建ssm詳細(xì)教程(Spring+Spring Mvc+Mybatis)的文章就介紹到這了,更多相關(guān)idea搭建ssm內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- 使用IDEA搭建SSM框架的詳細(xì)教程(spring + springMVC +MyBatis)
- IDEA上面搭建一個(gè)SpringBoot的web-mvc項(xiàng)目遇到的問題
- 在IntelliJ IDEA 搭建springmvc項(xiàng)目配置debug的教程詳解
- 使用idea搭建一個(gè)spring mvc項(xiàng)目的圖文教程
- 在IDEA中搭建最小可用SpringMVC項(xiàng)目(純Java配置)
- 如何使用Idea搭建全注解式開發(fā)的SpringMVC項(xiàng)目
- SpringMVC框架搭建idea2021.3.2操作數(shù)據(jù)庫(kù)的示例詳解
- 使用Idea快速搭建SpringMVC項(xiàng)目的詳細(xì)步驟記錄
相關(guān)文章
關(guān)于Controller層和Service層的類報(bào)錯(cuò)問題及解決方案
這篇文章主要介紹了關(guān)于Controller層和Service層的類報(bào)錯(cuò)問題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-02-02
JAVA實(shí)現(xiàn)Date日期加一天具體方法
這篇文章主要給大家介紹了關(guān)于JAVA實(shí)現(xiàn)Date日期加一天的相關(guān)資料,因?yàn)樵陧?xiàng)目中遇到了需要將日期進(jìn)行加減一些天數(shù)的操作,文中給出了簡(jiǎn)單的代碼示例,需要的朋友可以參考下2023-07-07
Mybatis #foreach中相同的變量名導(dǎo)致值覆蓋的問題解決
本文主要介紹了Mybatis #foreach中相同的變量名導(dǎo)致值覆蓋的問題解決,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-07-07
Java 實(shí)現(xiàn)滑動(dòng)時(shí)間窗口限流算法的代碼
這篇文章主要介紹了Java 實(shí)現(xiàn)滑動(dòng)時(shí)間窗口限流算法的代碼,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-11-11
Java后端實(shí)現(xiàn)生成驗(yàn)證碼圖片的示例代碼
驗(yàn)證碼是一種用于驗(yàn)證用戶身份或確保用戶操作安全的技術(shù)手段,通常以圖形、聲音或文字的形式出現(xiàn),本文主要介紹了如何通過(guò)java實(shí)現(xiàn)生成驗(yàn)證碼圖片,需要的可以參考下2023-12-12
SpringBoot實(shí)現(xiàn)短鏈接系統(tǒng)的使用示例
由于短鏈接可能涉及到用戶隱私和安全問題,所以短鏈接系統(tǒng)也需要符合相關(guān)的數(shù)據(jù)保護(hù)和安全標(biāo)準(zhǔn),本文主要介紹了SpringBoot實(shí)現(xiàn)短鏈接系統(tǒng)的使用示例,感興趣的可以了解一下2023-09-09
Java 數(shù)組復(fù)制clone方法實(shí)現(xiàn)詳解
這篇文章主要介紹了Java 數(shù)組復(fù)制clone方法實(shí)現(xiàn)詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-11-11
springboot項(xiàng)目中PropertySource如何讀取yaml配置文件
這篇文章主要介紹了springboot項(xiàng)目中PropertySource如何讀取yaml配置文件問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-01-01

