黎明前的黑暗
一切不行都是人不行
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));
    }
}

 

posted on 2019-05-16 13:49  无厘头的小情绪  阅读(5007)  评论(0编辑  收藏  举报