springmvc+spring+mybatis+mysql框架整合(maven模块化分层)01

</pre><span style="font-size:14px;">1.配置maven本地仓库,修改默认的仓库位置,默认是在C:\Users\Administrator\.m2\repository</span></p><p><span style="font-size:14px;">maven\conf\setting.xml文件</span><pre name="code" class="html"><span style="font-size:14px;">|-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    
    <localRepository>
       E:\myDemoRepository
    </localRepository>
    </span>

别忘记了eclipse中也要设置。一定要Update一下。



创建普通maven工程


ok,下面我们先创建springmybatis工程,这个工程主要集成开发环境所要的jar包没有任何代码逻辑。

pom.xml如下:


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
<!-- 指定父模块,使用相对路径,父模块中必须有pom.xml文件 -->
	<parent>
		<relativePath>../yycgparent</relativePath>
		<groupId>yycg</groupId>
		<artifactId>yycgparent</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>
<!--   <groupId>demo</groupId> -->
  <artifactId>srpingmybatis</artifactId>
<!--   <version>0.0.1-SNAPSHOT</version> -->
  <packaging>jar</packaging>
  <name>srpingmybatis</name>
  <url>http://maven.apache.org</url>

  <properties>
		<spring.version>3.1.4.RELEASE</spring.version>
		<mybatis.version>3.2.3</mybatis.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>


		<!-- springmvc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>

		<!-- mybatis -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>${mybatis.version}</version>
			<!-- <scope>provided</scope> -->
		</dependency>

		<dependency>
			<groupId> org.aspectj</groupId>
			<artifactId> aspectjweaver</artifactId>
			<version> 1.6.11</version>
		</dependency>
		<!-- mybatis依赖 -->
		<dependency>
			<groupId>ognl</groupId>
			<artifactId>ognl</artifactId>
			<version>2.6.9</version>
			<!-- <scope>provided</scope> -->
			<!-- <optional>true</optional> -->
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.7.5</version>
			<!-- <optional>true</optional> -->
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.7.5</version>
			<!-- <optional>true</optional> -->
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.17</version>
			<!-- <optional>true</optional> -->
		</dependency>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
			<version>2.0-beta9</version>
			<!-- <optional>true</optional> -->
		</dependency>
		<dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
			<version>1.1.1</version>
			<!-- <optional>true</optional> -->
		</dependency>
		<dependency>
			<groupId>org.javassist</groupId>
			<artifactId>javassist</artifactId>
			<version>3.17.1-GA</version>
			<!-- <optional>true</optional> -->
		</dependency>
		<dependency>
			<groupId>cglib</groupId>
			<artifactId>cglib</artifactId>
			<version>2.2.2</version>
			<!-- <optional>true</optional> -->
		</dependency>

		<!-- spring mybatis -->

		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.2.2</version>
			<!-- <scope>provided</scope> -->
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${spring.version}</version>
			<!-- <scope>provided</scope> -->
		</dependency>

		<dependency>
			<groupId>org.springframework.batch</groupId>
			<artifactId>spring-batch-infrastructure</artifactId>
			<version>2.2.2.RELEASE</version>
			<!-- <scope>provided</scope> -->
		</dependency>

		<!-- Test dependencies -->

		<dependency>
			<groupId>com.atomikos</groupId>
			<artifactId>transactions-jdbc</artifactId>
			<version>3.9.0</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.derby</groupId>
			<artifactId>derby</artifactId>
			<version>10.10.1.1</version>
			<scope>test</scope>
		</dependency>


		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${spring.version}</version>
			<!-- <scope>test</scope> -->
		</dependency>

	</dependencies>
	<build>
		<finalName>springmybatis</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

这样就完成了springmvc spring mybatis的集成了




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值