You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
541 B
18 lines
541 B
package cn.star.test;
|
|
|
|
import cn.star.service.UsersService;
|
|
import org.junit.Test;
|
|
import org.springframework.context.ApplicationContext;
|
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|
|
|
public class SpringTest {
|
|
@Test
|
|
public void Test(){
|
|
//加载配置文件
|
|
ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:spring.xml");
|
|
//获取对象
|
|
UsersService us = (UsersService) ac.getBean("usersService");
|
|
//调用方法
|
|
us.findUsers();
|
|
}
|
|
}
|