(实战篇)SSM三大框架整合详细教程(Spring+SpringMVC+MyBatis)

xiaoxiao2021-02-27  285

< pre class = "html" name = "code" snippet_file_name = "blog_20170402_1_8023453" code_snippet_id = "2295822" >< span style = "font-size:14px;" >< 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/maven-v4_0_0.xsd" >    < modelVersion >4.0.0</ modelVersion >    < groupId >PetTest</ groupId >    < artifactId >pet-commonTest</ artifactId >    < packaging >war</ packaging >    < version >0.0.1-SNAPSHOT</ version >    < name >pet-commonTest Maven Webapp</ name >    < url >http://maven.apache.org</ url >    < properties >        < project.build.sourceEncoding >UTF-8</ project.build.sourceEncoding >        < spring.version >4.2.0.RELEASE</ spring.version >        < jackson-core.version >2.6.1</ jackson-core.version >        <!-- log4j日志文件管理包版本 -->          < slf4j.version >1.7.7</ slf4j.version >          < log4j.version >1.2.17</ log4j.version >    </ properties >      < dependencies >      < dependency >        < groupId >junit</ groupId >        < artifactId >junit</ artifactId >        < version >4.12</ version >        < scope >test</ scope >      </ dependency >        <!-- servlet -->      < dependency >          < groupId >javax.servlet</ groupId >          < artifactId >javax.servlet-api</ artifactId >          < version >3.1.0</ version >      </ dependency >        <!-- spring -->      < dependency >          < groupId >org.springframework</ groupId >          < artifactId >spring-core</ artifactId >          < version >${spring.version}</ version >      </ dependency >      < dependency >          < groupId >org.springframework</ groupId >          < artifactId >spring-webmvc</ artifactId >          < version >${spring.version}</ version >      </ dependency >      < dependency >          < groupId >org.springframework</ groupId >          < artifactId >spring-context</ artifactId >          < version >${spring.version}</ version >      </ dependency >      < dependency >          < groupId >org.springframework</ groupId >          < artifactId >spring-tx</ artifactId >          < version >${spring.version}</ version >      </ dependency >      < dependency >          < groupId >org.springframework</ groupId >          < artifactId >spring-jdbc</ artifactId >          < version >${spring.version}</ version >      </ dependency >           <!-- mysql -->      < dependency >          < groupId >mysql</ groupId >          < artifactId >mysql-connector-java</ artifactId >          < version >5.1.36</ version >      </ dependency >        <!-- JSTL标签类 -->          < dependency >              < groupId >jstl</ groupId >              < artifactId >jstl</ artifactId >              < version >1.2</ version >          </ dependency >          <!-- 日志文件管理包 -->          <!-- log start -->          < dependency >              < groupId >log4j</ groupId >              < artifactId >log4j</ artifactId >              < version >${log4j.version}</ version >          </ dependency >          <!-- 格式化对象,方便输出日志 -->          < dependency >              < groupId >org.slf4j</ groupId >              < artifactId >slf4j-api</ artifactId >              < version >${slf4j.version}</ version >          </ dependency >          < dependency >              < groupId >org.slf4j</ groupId >              < artifactId >slf4j-log4j12</ artifactId >              < version >${slf4j.version}</ version >          </ dependency >        <!-- mybatis -->      < dependency >          < groupId >org.mybatis</ groupId >          < artifactId >mybatis</ artifactId >          < version >3.3.0</ version >      </ dependency >      < dependency >          < groupId >org.mybatis</ groupId >          < artifactId >mybatis-spring</ artifactId >          < version >1.2.3</ version >      </ dependency >              < dependency >          < groupId >commons-dbcp</ groupId >          < artifactId >commons-dbcp</ artifactId >          < version >1.4</ version >      </ dependency >    </ dependencies >    < build >      < finalName >pethome</ finalName >      < resources >         <!-- maven项目中src源代码下的xml等资源文件编译进classes文件夹,          注意:如果没有这个,它会自动搜索resources下是否有mapper.xml文件,          如果没有就会报org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.pet.mapper.PetMapper.selectByPrimaryKey-->        < resource >           < directory >src/main/java</ directory >           < includes >             < include >**/*.xml</ include >           </ includes >         </ resource >                <!--将resources目录下的配置文件编译进classes文件  -->          < resource >          < directory >src/main/resources</ directory >         </ resource >      </ resources >     </ build > </ project ></ span > </ pre >
转载请注明原文地址: https://www.6miu.com/read-8383.html

最新回复(0)