package com.test.controller;
import com.test.dao.TeacherMapper;
import com.test.model.TeacherEntity;
import net.sf.json.JSONArray;
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;
import javax.annotation.PostConstruct;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml", "classpath:dispatcher-servlet.xml"})
public class test {
@Autowired
TeacherMapper teacherMapper;
private static test factory;
@PostConstruct
public void init() {
factory = this;
}
public static void demo(){
List<TeacherEntity> teacherList =factory.teacherMapper.getList();
System.out.println(JSONArray.fromObject(teacherList));
}
}