import cn.itcast.mybatis.pojo.User; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({"classpath*:mybatis-config2.xml"}) //载入配置xml文件 public class UserMapperTest3 extends AbstractTransactionalJUnit4SpringContextTests { @Autowired private UserMapper userMapper; @Test public void testQueryUserByUserNameAndPassword() { User user = this.userMapper.queryUserByUserNameAndPassword("zw", "2"); System.out.println(user); } }
注:http://blog.csdn.net/yaerfeng/article/details/25368447
时间: 2024-12-21 22:02:46