-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme
69 lines (61 loc) · 2.46 KB
/
readme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
首先这是mybatis与springmvc 的整合
先将基础的配置好,然后利用mybatis-genterator自动生成代码
其中的注意事项:
关于依赖的引用要做到,明确引用那些依赖,依赖版本号的统一
首先在pom中:
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*.properties</include>
<include>*.xml</include>
<include>data/*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.37</version>
</dependency>
</dependencies>
</plugin>
<!-- resource插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<excludes>
<exclude>*.properties</exclude>
<exclude>data/*</exclude>
<exclude>generatorConfig.xml</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
其次配置resources中创建generatorConfig.xml
可参考:http://mybatis.org/generator/configreference/xmlconfig.html
之后可以运行Maven projects->mybatis-generator:generator 运行后将程序拷贝到src/main/java的对应目录下
最后在applicationConfig.xml,1)自动扫描2)配置事务3)DBCP数据源4)bean