SSM整合

发布时间 2023-07-28 14:04:10作者: 溯鸣

SSM整合流程

1.创建工程

 pom.xml添加依赖和插件:

 1 <dependencies>
 2     <dependency>
 3       <groupId>org.springframework</groupId>
 4       <artifactId>spring-webmvc</artifactId>
 5       <version>5.2.10.RELEASE</version>
 6     </dependency>
 7 
 8     <dependency>
 9       <groupId>org.springframework</groupId>
10       <artifactId>spring-jdbc</artifactId>
11       <version>5.2.10.RELEASE</version>
12     </dependency>
13 
14     <dependency>
15       <groupId>org.springframework</groupId>
16       <artifactId>spring-test</artifactId>
17       <version>5.2.10.RELEASE</version>
18     </dependency>
19 
20     <dependency>
21       <groupId>org.mybatis</groupId>
22       <artifactId>mybatis</artifactId>
23       <version>3.5.6</version>
24     </dependency>
25 
26     <dependency>
27       <groupId>org.mybatis</groupId>
28       <artifactId>mybatis-spring</artifactId>
29       <version>1.3.0</version>
30     </dependency>
31 
32     <dependency>
33       <groupId>mysql</groupId>
34       <artifactId>mysql-connector-java</artifactId>
35       <version>8.0.13</version>
36     </dependency>
37 
38     <dependency>
39       <groupId>com.alibaba</groupId>
40       <artifactId>druid</artifactId>
41       <version>1.1.16</version>
42     </dependency>
43 
44     <dependency>
45       <groupId>junit</groupId>
46       <artifactId>junit</artifactId>
47       <version>4.12</version>
48       <scope>test</scope>
49     </dependency>
50 
51     <dependency>
52       <groupId>javax.servlet</groupId>
53       <artifactId>javax.servlet-api</artifactId>
54       <version>3.1.0</version>
55       <scope>provided</scope>
56     </dependency>
57 
58     <dependency>
59       <groupId>com.fasterxml.jackson.core</groupId>
60       <artifactId>jackson-databind</artifactId>
61       <version>2.9.0</version>
62     </dependency>
63   </dependencies>
64 
65   <build>
66     <plugins>
67       <plugin>
68         <groupId>org.apache.tomcat.maven</groupId>
69         <artifactId>tomcat7-maven-plugin</artifactId>
70         <version>2.2</version>
71         <configuration>
72           <port>80</port>
73           <path>/</path>
74         </configuration>
75       </plugin>
76     </plugins>
77   </build>

 


2.SSM整合
  Spring
    SpringConfig
  MyBatis
    MybatisConfig
    JdbcConfig
    jdbc.properties
  SpringMVC
    ServletConfig
    SpringMvcConfig
3.功能模块
  表与实体类
  dao(接口+自动代理)
  service(接口+实现类)
    业务层接口测试(整合JUnit)
  controller
    表现层接口测试(PostMan)