详解Spring与Mybatis整合方法(基于IDEA中的Maven整合)

网友投稿 264 2022-11-17


详解Spring与Mybatis整合方法(基于IDEA中的Maven整合)

项目结构

项目路径可以自己定义,只要路径映射正确就可以

pom.xml

5.1.5.RELEASE

3.4.6

1.2.17

junit

junit

4.11

test

org.projectlombok

lombok

1.18.14

provided

org.springframework

spring-core

${spring.version}

org.springframework

spring-web

${spring.version}

org.springframework

spring-oxm

${spring.version}

org.springframework

spring-tx

${spring.version}

org.springframework

spring-jdbc

${spring.version}

org.springframework

spring-webmvc

${spring.version}

org.springframework

${spring.version}

org.springframework

spring-context

${spring.version}

</dependency>

org.springframework

spring-test

${spring.version}

org.mybatis

mybatis

${mybatis.version}

org.mybatis

mybatis-spring

1.3.2

mysql

mysql-connector-java

5.1.17

com.mchange

c3p0

0.9.5.5

jstl

jstl

1.2

org.apache.commons

commons-dbcp2

2.7.0

<groupId>commons-io

commons-io

2.4

commons-logging

commons-logging

1.2

org.junit.jupiter

junit-jupiter

RELEASE

compile

Emp.java,EmpMapper.java, EmpMapper.xml

https://jb51.net/article/197594.htm

db.properties

# mysql

jdbc.url=NqnxksUNjdbc:mysql://localhost:3306/jektong?useUnicode=true&characterEncoding=utf-8

jdbc.driver=com.mysql.jdbc.Driver

jdbc.username=jektong

jdbc.password=123456

这里的key值不能写url,driver,username,password,不然后面使用${url},${username}会报错

applicationContext.xml

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xmlns:context="http://springframework.org/schema/context"

xmlns:jdbc="http://springframework.org/schema/jdbc"

xmlns:jee="http://springframework.org/schema/jee"

xmlns:tx="http://springframework.org/schema/tx"

xmlns:aop="http://springframework.org/schema/aop"

xmlns:mvc="http://springframework.org/schema/mvc"

xmlns:util="http://springframework.org/schema/util"

xsi:schemaLocation="

http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-4.1.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.1.xsd

http://springframework.org/schema/jdbc http://springframework.org/schema/jdbc/spring-jdbc-4.1.xsd

http://springframework.org/schema/jee http://springframework.org/schema/jee/spring-jee-4.1.xsd

http://springframework.org/schema/tx http://springframework.org/schema/tx/spring-tx-4.1.xsd

http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-4.1.xsd

http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc-4.1.xsd

http://springframework.org/schema/util http://springframework.org/schema/util/spring-util-4.1.xsd

http://springframework.org/schema/jdbc

http://springframework.org/schema/jdbc ">

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xmlns:context="http://springframework.org/schema/context"

xmlns:jdbc="http://springframework.org/schema/jdbc"

xmlns:jee="http://springframework.org/schema/jee"

xmlns:tx="http://springframework.org/schema/tx"

xmlns:aop="http://springframework.org/schema/aop"

xmlns:mvc="http://springframework.org/schema/mvc"

xmlns:util="http://springframework.org/schema/util"

xsi:schemaLocation="

http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-4.1.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.1.xsd

http://springframework.org/schema/jdbc http://springframework.org/schema/jdbc/spring-jdbc-4.1.xsd

http://springframework.org/schema/jee http://springframework.org/schema/jee/spring-jee-4.1.xsd

http://springframework.org/schema/tx http://springframework.org/schema/tx/spring-tx-4.1.xsd

http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-4.1.xsd

http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc-4.1.xsd

http://springframework.org/schema/util http://springframework.org/schema/util/spring-util-4.1.xsd

http://springframework.org/schema/jdbc

http://springframework.org/schema/jdbc ">


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:如何通过Kaptcha在Web页面生成验证码
下一篇:J2EE Servlet基础在浏览器上运行HelloServlet的方法
相关文章

 发表评论

暂时没有评论,来抢沙发吧~