1
0
mirror of https://gitee.com/coder-xiaomo/java-note synced 2025-09-06 03:51:37 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-01-21 13:49:56 +08:00
parent 42e86626bf
commit b0fe86996c

View File

@@ -3355,6 +3355,8 @@ https://mvnrepository.com/artifact/org.mybatis/mybatis-spring/2.0.6
**Druid依赖**(阿里巴巴数据源)
<span id="Druid依赖"></span>
https://mvnrepository.com/artifact/com.alibaba/druid/1.2.8
```xml
@@ -3388,6 +3390,8 @@ https://mvnrepository.com/artifact/org.springframework/spring-test/5.2.19.RELEAS
**Spring JDBC**
<spanid="SpringJDBC依赖"></spanid=>
https://mvnrepository.com/artifact/org.springframework/spring-jdbc/5.2.19.RELEASE
```xml
@@ -3852,6 +3856,8 @@ Process finished with exit code 0
**导入commons-logging依赖**
<span id="commons-logging依赖"></span>
https://mvnrepository.com/artifact/commons-logging/commons-logging/1.2
```xml
@@ -3865,6 +3871,8 @@ https://mvnrepository.com/artifact/commons-logging/commons-logging/1.2
**导入slf4j-log4j12依赖**
<span id="slf4j-log4j12依赖"></span>
https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12/1.7.25
```xml
@@ -4121,6 +4129,8 @@ public class UserService {
导入spring-webmvc依赖
<span id="springwebmvc依赖"></span>
https://mvnrepository.com/artifact/org.springframework/spring-webmvc/5.2.19.RELEASE
```xml
@@ -4564,6 +4574,8 @@ https://www.thymeleaf.org/
###### 导入thymeleaf依赖
<span id="thymeleaf依赖"></span>
https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf/3.0.14.RELEASE
```xml
@@ -4575,7 +4587,9 @@ https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf/3.0.14.RELEASE
</dependency>
```
###### 导入thymeleaf依赖
###### 导入thymeleaf-spring4依赖
<span id="thymeleaf-spring4依赖"></span>
https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf-spring4/3.0.14.RELEASE
@@ -4835,6 +4849,143 @@ tomcat/conf/server.xml
### SSM框架整合
> MyBatis、Spring、SpringMVC三个框架整合
[创建Mavenweb项目](#创建Mavenweb项目)
#### 导入依赖
##### 需要导入的依赖
数据库:[MyBatis](#mybatis依赖)、[MySQL](#mysql依赖)
单元测试:[JUnit](#junit依赖)
实体类:[Lombok](#Lombok依赖)
数据源:[Druid](#Druid依赖)
Spring[Spring](#spring依赖)、[Spring JDBC](#SpringJDBC依赖)、[Spring Web MVC](#springwebmvc依赖)
页面:[Thymeleaf](#thymeleaf依赖)、[Thymeleaf Spring4](#thymeleaf-spring4依赖)
日志:[log4j](#log4j依赖)、[commons-logging](#commons-logging依赖)、[slf4j-log4j12](#slf4j-log4j12依赖)
##### 如下
```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>ssm</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<!-- mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.9</version>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
<!-- junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<scope>provided</scope>
</dependency>
<!-- druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.8</version>
</dependency>
<!-- spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.19.RELEASE</version>
</dependency>
<!-- spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.19.RELEASE</version>
</dependency>
<!-- spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.19.RELEASE</version>
</dependency>
<!-- thymeleaf -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.14.RELEASE</version>
</dependency>
<!-- thymeleaf-spring4 -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring4</artifactId>
<version>3.0.14.RELEASE</version>
</dependency>
<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<!-- slf4j-log4j12 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
```
## 提升