Roma
世界已黑白,此人已成仙。

年少轻狂,总以为天下事竭力有为。人事尽时,终感力不能及。

 

 工程创建完成后在pom文件中导入jia包

<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.2.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.6</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.0.pr4</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>80</port>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>

暂时导入这些

创建包结构

 

 

 创建Springclass的配置文件

 

 

 

新建jdbc的配置类和mybatis的配置类,连接数据库要用的properties文件

JdbcConfig:

 

 

 

 

 

MyBatisConfig:

 

 

 

 

 

 

jdbc.properties:

在SpringConfig类中需要加载jdbc.properties

 

 

 

 

 

 

 

 

Spring整合mvc的东西

新建一个SpringMvcConfig类

 

 

 

创建一个ServletConfig web容器类叫啥名不重要

 

 

 

 

 

 

加载配置JdbcConfig和MyBatisConfig类

 

posted on 2022-09-28 22:29  罗|马  阅读(21)  评论(0编辑  收藏  举报

Live2D