SSM框架的整合

SSM框架的整合

我的学习博客: 狂神说SpringMVC05:整合SSM框架 (qq.com)

我是根据这个博客学的

说是SSM框架的整合,其实还是重新创建一个项目,正好学习从0开始写一个项目的方法。

环境要求

  • IDEA
  • maven 3.6(以上)
  • Tomact9 (以下)
  • MySQL 5.7(以上)

第一步,分析需求设计数据库

我们这里仅仅创建一个非常简单ed图书管理系统,创建一个非常简单的数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
CREATE DATABASE ssmbuild;
USE ssmbuild;
CREATE TABLE `books`(
`bookID` INT NOT NULL AUTO_INCREMENT COMMENT '书id',
`bookName` VARCHAR(100) NOT NULL COMMENT '书名',
`bookCounts` INT NOT NULL COMMENT '数量',
`detail` VARCHAR(200) NOT NULL COMMENT '描述',
KEY `bookID`(`bookID`)
)ENGINE=INNODB DEFAULT CHARSET=utf8;

INSERT INTO `books`(`bookID`,`bookName`,`bookCounts`,`detail`)VALUES
(1,'Java',1,'从入门到放弃'),
(2,'MySQL',10,'从删库到跑路'),
(3,'Linux',5,'从进门到进牢')

数据库样貌

第二步,创建javaweb项目

修改web.xml文件中的配置

1
2
3
4
5
6
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

</web-app>

第三步,导入环境依赖

包括;

  • junit
  • 数据驱动和连接池
  • servlet
  • jsp
  • mybatis
  • mybatis-Spring
  • Spring的一系列包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.4</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>有提示</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.9.RELEASE</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>

</dependencies>

并且顺手处理了可能存在的mybatis环境不仅如此target问题:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>

第四步,链接数据库

连接数据库

第五步,编写包结构

我们创建一个程序,最基础的包结构有:

  • Mapper(永久层)
  • POJO(实体类)
  • service
  • Controller(原 servlet)

以及在resource下创建;

  • mybatis-config.xml(mybatis的核心配置文件)
  • applicationContext.xml(Spring的核心配置文件)

并导入他们的配置头文件

完整的包结构

mybatis-config.xml

1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

</configuration>

applicationContext.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">


</beans>

第六步,mybatis关联数据库

在resource下创建db.properties文件,并且写入链接数据库所需的一切参数

1
2
3
4
driver = com.mysql.cj.jdbc.Driver
url = jdbc:mysql://localhost:3306/mybatis?useUnicode=true&characterEnconding=utf8&useSSL=true
username = dwx
password = 123456

本身是需要在mybatis中关联的,但是由于我们使用Spring整合了mybatis,这部分内容就不需要mybatis做了,mybatis只需要对别名进行处理,或者注册mapper.xml

此时的mybatis-config.xml文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

<!--联结数据库的工作交给Spring-->


<!--使用别名 对实体类使用别名-->
<typeAliases>
<package name="com.dwx.pojo"/>
</typeAliases>
<!--注册mapper.xml-->


</configuration>

第七步,编写pojo类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.dwx.pojo;

public class Books {
private int bookID;
private String bookName;
private int bookCounts;
private String detail;

public Books(int bookID, String bookName, int bookCounts, String detail) {
this.bookID = bookID;
this.bookName = bookName;
this.bookCounts = bookCounts;
this.detail = detail;
}

public Books() {
}

public int getBookID() {
return bookID;
}

public void setBookID(int bookID) {
this.bookID = bookID;
}

public String getBookName() {
return bookName;
}

public void setBookName(String bookName) {
this.bookName = bookName;
}

public int getBookCounts() {
return bookCounts;
}

public void setBookCounts(int bookCounts) {
this.bookCounts = bookCounts;
}

public String getDetail() {
return detail;
}

public void setDetail(String detail) {
this.detail = detail;
}

@Override
public String toString() {
return "Books{" +
"bookID=" + bookID +
", bookName='" + bookName + '\'' +
", bookCounts=" + bookCounts +
", detail='" + detail + '\'' +
'}';
}
}

此处我们没有使用注解开发,如果使用注解就要导入Lombok的·包,

具体过程如这篇博客: Lombok插件的使用 | dwx-tx的小天地

要求:实体类的参数的类型的名字要与数据库中的一致。

第八步,接口实现操作

在Dao层创建接口,写出预计的操作。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.dwx.mapper;

import com.dwx.pojo.Books;
import org.apache.ibatis.annotations.Param;

import java.awt.print.Book;
import java.util.List;

public interface BooksMapper {

//接口实现操作
//增加书籍操作
int addBook(Books books);

//删除书籍操作:通过ID
int deleteBook(@Param("bookID") int id);

//修改图书信息
int updateBook(Books books);

//查询书籍byID
Books queryBook(@Param("bookID") int id);

//查询所有的数据
List<Books> queryBooks();
}

此处使用@Param("")表示以后参数可以使用别名

第九步,编写实现Mapper

此时就用到Mybatis了,在Mapper层下创造一个和接口同名的xml文件,并且导入Mapper配置。

修改<mapper></mapper>的命名空间为接口的名字

1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dwx.mapper.BooksMapper">

</mapper>

编写SQL,实现sql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dwx.mapper.BooksMapper">

<!--增加书籍操作-->
<insert id="addBook" parameterType="books">
insert into ssmbuild.books (bookName,bookCounts,detail)
VALUES #{bookName},#{bookCounts},#{detai});
</insert>

<!--删除书籍操作-->
<delete id="deleteBook" parameterType="int">
delete from ssmbuild.books
where bookID = #{bookID};
</delete>

<!--修改图书信息-->
<update id="updateBook" parameterType="books">
update ssmbuild.books
set bookName = #{bookName},bookCounts = #{bookCounts},detail = #{detail}
where bookID = #{bookID};
</update>

<!--查询书籍ByID-->
<select id="queryBook" parameterType="int" resultType="books">
select * from ssmbuild.books where bookID = #{bookID};
</select>

<!--查询所有的书籍-->
<select id="queryBooks" resultType="books">
select * from ssmbuild.books;
</select>

</mapper>

实现的xml编写完后,要迅速到mybatis-config.xml中进行配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

<!--联结数据库的工作交给Spring-->


<!--使用别名 对实体类使用别名-->
<typeAliases>
<package name="com.dwx.pojo"/>
</typeAliases>
<!--注册mapper.xml-->
<mappers>
<mapper class="com.dwx.mapper.BooksMapper"/>
</mappers>


</configuration>

第十步,编写service层(接口加实现类)

service层的唯一作用就是链接DAO层,将数据传递到Controller层,因此,在service层中需要调用DAO层(引用这个层)

接口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.dwx.service;

import com.dwx.pojo.Books;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface BooksService {

//service层做得工作和Dao层差不多


int addBook(Books books);

//删除书籍操作:通过ID
int deleteBook(@Param("bookID") int id);

//修改图书信息
int updateBook(Books books);

//查询书籍byID
Books queryBook(@Param("bookID") int id);

//查询所有的数据
List<Books> queryBooks();
}

实现类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.dwx.service;

import com.dwx.mapper.BooksMapper;
import com.dwx.pojo.Books;

import java.util.List;

public class BookServiceImpl implements BooksService{

//调用DAO层
private BooksMapper booksMapper;
//由于是使用mybatis,因此一定要使用set方法,因为mybatis是支持set注入的
public void setBooksMapper(BooksMapper booksMapper) {
this.booksMapper = booksMapper;
}

//此时使用这个mapper对象就能实现操作了

@Override
public int addBook(Books books) {
return booksMapper.addBook(books);
}

@Override
public int deleteBook(int id) {
return booksMapper.deleteBook(id);
}

@Override
public int updateBook(Books books) {
return booksMapper.updateBook(books);
}

@Override
public Books queryBook(int id) {
return booksMapper.queryBook(id);
}

@Override
public List<Books> queryBooks() {
return booksMapper.queryBooks();
}
}

第十一步,整合Spring

spring能够整合每一层,并且在每一层都创建一个xml

Spring整合DAO层

创建SpringDAO/mapper.xml并且导入依赖

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">


</beans>


对于这个xml要做到的功能如下:

  • 关联数据库配置文件

  • 链接池

  • SqlSessionFactory

  • 将DAO接口注入到Spring容器中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!--关联数据库配置文件-->
<context:property-placeholder location="classpath:db.properties"/>
<!--连接池-->
<!--这个c3j0数据库源有问题,我们使用我们Mybatis默认的数据源-->
<!--&lt;!&ndash; 这里我们使用的链接池是c3j0&ndash;&gt;-->
<!-- <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">-->
<!-- <property name="driverClass" value="${driver}"/>-->
<!-- <property name="password" value="${password}"/>-->
<!-- <property name="user" value="${username}"/>-->
<!-- <property name="jdbcUrl" value="${url}"/>-->
<!-- &lt;!&ndash;对这个连接池进行一点个性化配置&ndash;&gt;-->
<!-- &lt;!&ndash; c3p0连接池的私有属性 &ndash;&gt;-->
<!-- <property name="maxPoolSize" value="30"/>-->
<!-- <property name="minPoolSize" value="10"/>-->
<!-- &lt;!&ndash; 关闭连接后不自动commit &ndash;&gt;-->
<!-- <property name="autoCommitOnClose" value="false"/>-->
<!-- &lt;!&ndash; 获取连接超时时间 &ndash;&gt;-->
<!-- <property name="checkoutTimeout" value="10000"/>-->
<!-- &lt;!&ndash; 当获取连接失败重试次数 &ndash;&gt;-->
<!-- <property name="acquireRetryAttempts" value="2"/>-->
<!-- </bean>-->
<!--整合数据库 数据源-->
<!--mybatis的默认数据库池-->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mybatis?useUnicode=true&amp;characterEnconding=utf8&amp;useSSL=truejdbc:mysql://localhost:3306/mybatis?useUnicode=true&amp;characterEnconding=utf8&amp;useSSL=true"/>
<property name="username" value="dwx"/>
<property name="password" value="123456"/>
</bean>
<!--sqlSessionFactory-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!--链接数据源-->
<property name="dataSource" ref="dataSource"/>
<!--绑定mybatis配置文件-->
<property name="configLocation" value="classpath:mybatis-config.xml"/>

</bean>
<!--配置永久层扫描包(动态的实现DAO接口可以注入到Spring容器中)-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!--注入SQLSessionFactory-->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
<!--配置要扫描的包-->
<property name="basePackage" value="com.dwx.mapper"/>
</bean>

</beans>



Spring整合service层

步奏:

  • 扫描service层下的包
  • 在service类上加上@Service表示被Spring托管
  • 将所有的业务类注册到Spring中
  • 声明式事务配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!--扫描Service的包-->
<context:component-scan base-package="com.dwx.service"/>
<!--将我们的业务类都朱擦到Spring中-->
<bean id="BooksServiceImpl" class="com.dwx.service.BookServiceImpl">
<!--Spring注入参数Mapper-->
<property name="booksMapper" ref="booksMapper"/>
</bean>
<!--声明式事务配置-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<!--绑定数据源-->
<property name="dataSource" ref="dataSource"/>
</bean>
</beans>


第十二步,整合SpringMVC

SpringMVC整合步奏:

  • 将web.xml文件换成最新的
  • 配置DispatchServlet
  • 解决乱码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<!--注册DispatcherServlet及其一些配置-->
<servlet>
<servlet-name>Spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!--解决乱码问题-->
<filter>
<filter-name>encoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

</web-app>

我们看这个配置,有一个classpath:springmvc-servlet.xml

这里是我们Spring整合Controller层,我们去编写这个

它要做到的事情:

  • 注解驱动
  • 扫描包
  • 静态资源过滤
  • 视图解析器
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">

<!--由于我们时使用的注解开发,因此需要添加配置 扫描要添加注解的包-->
<context:component-scan base-package="com.dwx.controller"/>
<!--让SpringMVC不处理静态资源-->
<mvc:default-servlet-handler/>
<!--这里我们使用下边这个配置代替 添加处理映射器 添加处理适配器-->
<mvc:annotation-driven/>

<!--编写适配视图解析器-->

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" id="internalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>


</beans>


第十三步,将我们写的几个子xml全部导入到Spring的核心配置文件中去

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<import resource="spring-mapper.xml"></import>
<import resource="spring-service.xml"></import>
<import resource="springmvc-servlet.xml"></import>
</beans>



到此时我们的SSM框架就彻底整合完毕了

Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.

扫一扫,分享到微信

微信分享二维码
  • Copyrights © 2015-2023 dwx
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信