-
Notifications
You must be signed in to change notification settings - Fork 0
Yhaojing/mybatisMixSpringMVC
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
首先这是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
About
springMvc中整合mybatis
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published