1. 程式人生 > 其它 >整合mybatis-spring需要的maven依賴配置

整合mybatis-spring需要的maven依賴配置

建立maven專案,匯入相關jar包

junit

1 <dependency>
2     <groupId>junit</groupId>
3     <artifactId>junit</artifactId>
4     <version>4.12</version>
5 </dependency>

mybatis

1 <dependency>
2     <groupId>org.mybatis</groupId>
3     <artifactId>
mybatis</artifactId> 4 <version>3.5.2</version> 5 </dependency>

mysql-connector-java

1 <dependency>
2     <groupId>mysql</groupId>
3     <artifactId>mysql-connector-java</artifactId>
4     <version>5.1.47</version>
5 </dependency>

spring,特別注意匯入spring-jdbc

 1 <dependency>
 2     <groupId>org.springframework</groupId>
 3     <artifactId>spring-webmvc</artifactId>
 4     <version>5.1.10.RELEASE</version>
 5 </dependency>
 6 <dependency>
 7     <groupId>org.springframework</
groupId> 8 <artifactId>spring-jdbc</artifactId> 9 <version>5.1.10.RELEASE</version> 10 </dependency>

aspectJ AOP

1 <!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
2 <dependency>
3     <groupId>org.aspectj</groupId>
4     <artifactId>aspectjweaver</artifactId>
5     <version>1.9.4</version>
6 </dependency>

mybatis-spring

1 <dependency>
2     <groupId>org.mybatis</groupId>
3     <artifactId>mybatis-spring</artifactId>
4     <version>2.0.2</version>
5 </dependency>

解決maven靜態資源約定大於習慣問題

 1 <build>
 2     <resources>
 3         <resource>
 4             <directory>src/main/java</directory>
 5             <includes>
 6                 <include>**/*.properties</include>
 7                 <include>**/*.xml</include>
 8             </includes>
 9             <filtering>true</filtering>
10         </resource>
11     </resources>
12 </build>