MyBatis配置以及连接mysql数据库⼀、新建java web项⽬
⼆、导⼊jar包
导⼊MyBatis的jar包
spring的所有jar包下载地址:
spring+mybatis的jar包下载
mysql驱动下载
阿⾥巴巴数据库连接池jar包下载
以上jar包导⼊即可!
Maven的导⼊⽅式:
<project xmlns="/POM/4.0.0"xsi="/2001/XMLSchema-instance"schemaLocation="maven./POM/4.0.0 /xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MyBatisFirst</groupId>
<artifactId>MyBatisFirst</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>MyBatisFirst</name>
<description/>
<properties>
<webVersion>4.0</webVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<druid.version>1.1.17</druid.version>
<spring.version>5.1.6.RELEASE</spring.version>
<mybatis.spring.version>2.0.0</mybatis.spring.version>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.4</version>
</dependency>
<!-- MyBatis的配置 -->
<!-- mvnrepository/batis/mybatis -->
<dependency>
<groupId&batis</groupId>
mysql下载jar包
<artifactId>mybatis</artifactId>
<version>3.5.1</version>
</dependency>
<!-- druid数据源 -->
<!-- mvnrepository/artifact/com.alibaba/druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<!-- spring-jdbc spring操作数据库的驱动包 -->
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<!-- MyBatis和Spring连接的包 -->
<groupId&batis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis.spring.version}</version>
</dependency>
<!-- OJDBC8 -->
<dependency>
<groupId&acle.driver</groupId>
<artifactId>ojdbc8</artifactId>
<version>12c</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。