#环境配置 在Gradle或者Maven中添加Spring-test
#创建类
package com.hava.tactic.xml.access.repository;
import com.hava.tactic.sthpw.entity.LoginGroup;
import com.hava.tactic.sthpw.repository.LoginGroupDAO;
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;
import sun.rmi.runtime.Log;
import java.util.List;
/**
* Created by zhanpeng on 16-4-18.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/appconfig/mvc/spring/servlet-context.xml"})
public class AccessRulesSpringTest {
@Autowired
LoginGroupDAO loginGroupDAO;
@Test
public void test()
{
System.out.println(123);
List<LoginGroup> loginGroupList = loginGroupDAO.findAll();
for(LoginGroup loginGroup : loginGroupList)
loginGroup.printProperties();
}
}