zoukankan      html  css  js  c++  java
  • spring整合mybatis时不要忘了导spring-test包

    注意  1.类上面需要加两个注解 
    2:Caused by: java.lang.IllegalStateException: SpringJUnit4ClassRunner requires JUnit 4.12 or higher.
    举个栗子

     1 package com.qianfeng.test;
     2 
     3 import com.qianfeng.restfull.beans.TbHotel;
     4 import com.qianfeng.restfull.dao.IHotelDAO;
     5 import org.junit.Test;
     6 import org.junit.runner.RunWith;
     7 import org.springframework.beans.factory.annotation.Autowired;
     8 import org.springframework.test.context.ContextConfiguration;
     9 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
    10 
    11 import java.util.List;
    12 
    13 @RunWith(SpringJUnit4ClassRunner.class)
    14 @ContextConfiguration("classpath:spring.xml")
    15 public class SpringTest {
    16 
    17     @Autowired
    18     private IHotelDAO hotelDAO;
    19 
    20     @Test
    21     public void testCase1(){
    22         try {
    23             List<TbHotel> hotelList = hotelDAO.queryHotelByPage(0);
    24             System.out.println(hotelList);
    25         } catch (Exception e) {
    26             e.printStackTrace();
    27         }
    28     }
    29 }
    
    
    
     
    历经苦难而不厌,此乃阿修罗之道。
  • 相关阅读:
    Vulkan
    C# Optimization
    C# Bridge Pattern(Handle/Body)
    Favorite Games
    Unity Particle System Sorting Order
    UGUI
    C# Language Specification
    接口的显式实现和隐式实现
    C#反射机制
    wcf 使用sqlMembership证书认证
  • 原文地址:https://www.cnblogs.com/echo1314/p/10192808.html
Copyright © 2011-2022 走看看