Spring+Spring MVC+MyBatis框架整合

本文介绍了Spring+Spring MVC+MyBatis框架的整合过程,包括项目结构层次、文件组织结构和主要配置文件的详细说明,如db.properties、applicationContext.xml、mybatis-config.xml及springmvc-config.xml。
摘要由CSDN通过智能技术生成

1.项目结构层次

持久对象层(entity层):由若干实体类组成;

对象访问层(Dao层/mapper层):由若干DAO/mapper接口和MyBatis映射文件组成。

业务逻辑层(Service层):由若干Service接口和实体类组成。用于实现业务逻辑。

Web表现层(Controller层和页面):由若干Controller类和页面组成。Controller类用于处理页面请求,并于业务逻辑层进行交互。页面对业务数据进行呈现,并对用户的非法操作进行适当的控制。

2.文件组织结构

3.资源包

 

4.config目录下文件

4.1.db.properties

数据库相关配置文件

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/boot?useUnicode=true&characterEncoding=UTF-8&useSSL=false
jdbc.username=root
jdbc.password=056015
jdbc.maxTotal=30
jdbc.maxIdle=10
jdbc.initialSize=5

 4.2.applicationContext.xml 

Spring配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值