IDEA创建SSM(Spring+SpringMVC+Mybatis)项目-Jar包版(1)

3.jdbc.properties

8.0之前的driver

#driver=com.mysql.jdbc.Driver

8.0之后的driver

driver=com.mysql.cj.jdbc.Driver

#mytest为我本地的数据库名

url=jdbc:mysql://localhost:3306/maven-ssm-demo?serverTimezone=UTC

数据库用户名

username=root

数据库的密码

password=admin

定义初始连接数

initialSize=1

定义最大连接数

maxActive=20

定义最大空闲

maxIdle=20

定义最小空闲

minIdle=1

定义最长等待时间

maxWait=60000

4.log4j.properties

#日志输出级别

log4j.rootLogger=debug,stdout,D,E

#设置stdout的日志输出控制台

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

#输出日志到控制台的方式,默认为System.out

log4j.appender.stdout.Target = System.out

#设置使用灵活布局

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

#灵活定义输出格式

log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} -[%p] method:[%c (%rms)] - %m%n

5.spring-mvc.xml

<?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:context=“http://www.springframework.org/schema/context”

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/mvc

http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

<context:component-scan base-package=“com.sjsq”/>

mvc:annotation-driven/

mvc:default-servlet-handler/

6.web.xml

<?xml version="1.0" encoding="UTF-8"
  • 20
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SSMSpring+SpringMVC+MyBatis)框架集由SpringMyBatis两个开源框架整合而成(SpringMVCSpring中的部分内容)。常作为数据源较简单的web项目的框架。 Spring   Spring就像是整个项目中装配bean的大工厂,在配置文件中可以指定使用特定的参数去调用实体类的构造方法来实例化对象。也可以称之为项目中的粘合剂。   Spring的核心思想是IoC(控制反转),即不再需要程序员去显式地`new`一个对象,而是让Spring框架帮你来完成这一切。   SpringMVC   SpringMVC项目中拦截用户请求,它的核心Servlet即DispatcherServlet承担中介或是前台这样的职责,将用户请求通过HandlerMapping去匹配Controller,Controller就是具体对应请求所执行的操作。SpringMVC相当于SSH框架中struts。   mybatis   mybatis是对jdbc的封装,它让数据库底层操作变的透明。mybatis的操作都是围绕一个sqlSessionFactory实例展开的。mybatis通过配置文件关联到各实体类的Mapper文件,Mapper文件中配置了每个类对数据库所需进行的sql语句映射。在每次与数据库交互时,通过sqlSessionFactory拿到一个sqlSession,再执行sql命令。 页面发送请求给控制器,控制器调用业务层处理逻辑,逻辑层向持久层发送请求,持久层与数据库交互,后将结果返回给业务层,业务层将处理逻辑发送给控制器,控制器再调用视图展现数据。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值