package org.zsl.testmybatis;
import javax.annotation.Resource;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.alibaba.fastjson.JSON;
import com.cn.hnust.pojo.User;
import com.cn.hnust.service.IUserService;
@RunWith(SpringJUnit4ClassRunner.class) //表示继承了SpringJUnit4ClassRunner类
@ContextConfiguration(locations = {"classpath:spring-mybatis.xml"})
public class TestMyBatis {
private static Logger logger = Logger.getLogger(TestMyBatis.class);
// private ApplicationContext ac = null;
@Resource
private IUserService userService = null;
// @Before
// public void before() {
// ac = new ClassPathXmlApplicationContext("applicationContext.xml");
// userService = (IUserService) ac.getBean("userService");
// }
@Test
public void test1() {
User user = userService.getUserById(1);
// System.out.println(user.getUserName());
// logger.info("值:"+user.getUserName());
logger.info(JSON.toJSONString(user));
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Spring+SpringMVC+ Mybatis框架整合例子(SSM).zip (46个子文件)
Spring+SpringMVC+ Mybatis框架整合例子(SSM)
HNUST
org.zsl.hnust Maven Webapp
.classpath 1KB
.settings
com.genuitec.eclipse.j2eedt.core.prefs 1009B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.jdt.core.prefs 430B
org.eclipse.wst.common.project.facet.core.prefs.xml 161B
org.eclipse.core.resources.prefs 162B
.jsdtscope 530B
org.eclipse.wst.validation.prefs 50B
org.eclipse.wst.common.component 739B
org.eclipse.wst.common.project.facet.core.xml 397B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.m2e.core.prefs 90B
pom.xml 5KB
src
test
java
org
zsl
testmybatis
TestMyBatis.java 1KB
main
resources
jdbc.properties 290B
spring-mvc.xml 3KB
log4j.properties 925B
spring-mybatis.xml 3KB
java
com
cn
hnust
controller
UserController.java 750B
dao
IUserDao.java 348B
pojo
User.java 821B
service
IUserService.java 142B
impl
UserServiceImpl.java 508B
mapping
UserMapper.xml 3KB
webapp
WEB-INF
web.xml 2KB
jsp
showUser.jsp 244B
index.jsp 52B
.myumldata 66B
target
classes
jdbc.properties 290B
spring-mvc.xml 3KB
log4j.properties 925B
spring-mybatis.xml 3KB
com
cn
hnust
controller
UserController.class 1KB
dao
IUserDao.class 385B
pojo
User.class 1KB
service
IUserService.class 178B
impl
UserServiceImpl.class 888B
mapping
UserMapper.xml 3KB
test-classes
org
zsl
testmybatis
TestMyBatis.class 1KB
m2e-jee
web-resources
META-INF
MANIFEST.MF 114B
maven
org.zsl.hnust
HNUST
pom.properties 264B
pom.xml 5KB
org.zsl.hnust
pom.properties 273B
pom.xml 4KB
logs
ssm.log 124KB
.project 1KB
共 46 条
- 1
资源评论
金克斯在coding
- 粉丝: 1804
- 资源: 151
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功