-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.java
More file actions
24 lines (21 loc) · 815 Bytes
/
Client.java
File metadata and controls
24 lines (21 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.ui;
import com.config.SpringConfiguration;
import com.domain.Students;
import com.service.IStudentsService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import java.sql.SQLException;
import java.util.List;
public class Client {
@SuppressWarnings("all")
public static void main(String[] args) throws ClassNotFoundException, SQLException {
//1. 获取容器
ApplicationContext ac = new AnnotationConfigApplicationContext(SpringConfiguration.class);
IStudentsService cs = (IStudentsService) ac.getBean("studentsService");
List<Students> list=cs.findAllStudents();
for (Students stu :
list) {
System.out.println(stu);
}
}
}