import com.Config.SpringConfiguration;
import com.service.StudentService;
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.SpringJUnit4ClassRunner;
// 让测试运⾏于Spring测试环 境，以便在测试开始的时候⾃动创建Spring的应⽤上下⽂
@RunWith(SpringJUnit4ClassRunner.class)
// 使用配置文件的形式
//@ContextConfiguration("classpath:context.xml")
// 使用配置类
@ContextConfiguration(classes = {SpringConfiguration.class})
public class SpringJunitTest {
    @Autowired
    private StudentService service;
    @Test
    public void test1() {
        service.showStudent();
    }
}
