使用idea在编写的类下右键Go->Test或者ctrl+shift+t,点击create new test会在相应目录下创建test类 别写代码如下 @RunWith(value = SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:/config/**/applicationContext*.xml" }, loader = GenericXmlContextLoader…
两周前学习mybatis框架,参考了网上多位大神的博客,但因为各种原因(不解释)总是没法成功搭建环境并运行项目.周末花了点时间阅读了文档并整理之前琐碎的内容,解决掉之前遇到的问题.现将整合环境的关键步骤整理成学习手记一篇. 文章只提取了整合环境的主体过程,没有太深入的解析其中内容,若想深入学习mybaits,请自行阅读文档.源码,或参看网上其他大神的博客,本人菜鸟一只,只是做做学习笔记(ps:吃货请直接拖到底部). 1.导入spring核心包.spring测试包.mybatis核心包.mysql…
Maven项目下update maven后Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderL     严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.co…
Maven项目下update maven后Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderL     严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.co…
转载: http://xyly624.blog.51cto.com/842520/865630/ Maven项目下HttpServletRequest 或 HttpServletResponse需引用的依赖包:servlet-api.jar,并将scope设置为provided. pom.xml: <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifac…
建立mavan项目之后,在项目目录中没有发现编译的classes文件夹 解决办法: 因为maven是默认将编译后的classes文件存入项目下的target文件夹中,所以我们需要修改编译后存放的路径,将Default output folder修改为Wecat(项目名)/WebRoot/WEB-INF/classes,然后将所有的Output folder的属性值修改为WebRoot/WEB-INF/classes…
1.[导包]使用Spring测试套件,需要两个jar包:junit-X.X.jar和spring-test-X.X.X.RELEASE.jar,在maven项目下可添加如下依赖: <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>X.X</version> <scope>test</scope>…
经查,tomcat项目下的lib中没有jar包,发布的时候没有将jar包发布上去.这个问题在我的博客中以前遇到过.如何将maven的jar发布到项目中,我的博客里面有记载…
IDEA Maven项目的Mybatis逆向工程 1.配置.pom 如果是在多模块开发下,该文件逆向工程要生成的那个模块下的pom文件. <build> <plugins> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.5…
配置文件:xxxxx.properties a.url=******************** b.url=---------------------------------- 读取配置文件: import java.io.InputStream;import java.net.URL;import java.util.Iterator;import java.util.Properties; public class ReadProperties { public String getUrl…