main
parent
3425b54711
commit
1cbd412735
@ -0,0 +1,29 @@
|
|||||||
|
package com.ssm.ioc;
|
||||||
|
|
||||||
|
import com.ssm.di.xml.Announcement;
|
||||||
|
import com.ssm.di.xml.Movie;
|
||||||
|
import com.ssm.di.xml.ScreeningRoom;
|
||||||
|
import com.ssm.di.xml.ShowSchedule;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
|
public class TestIoc {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApplicationContext context = new ClassPathXmlApplicationContext("bean-ioc.xml");
|
||||||
|
|
||||||
|
Movie movie = (Movie) context.getBean("movie");
|
||||||
|
System.out.println(movie.toString());
|
||||||
|
|
||||||
|
Announcement announcement = (Announcement) context.getBean("announcement");
|
||||||
|
System.out.println(announcement);
|
||||||
|
|
||||||
|
Tag tag = (Tag) context.getBean("tag");
|
||||||
|
System.out.println(tag);
|
||||||
|
|
||||||
|
ShowSchedule showSchedule = (ShowSchedule) context.getBean("showSchedule");
|
||||||
|
System.out.println(showSchedule);
|
||||||
|
|
||||||
|
ScreeningRoom screeningRoom = (ScreeningRoom) context.getBean("screeningRoom");
|
||||||
|
System.out.println(screeningRoom);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue