@Bean(name = "jsrDAO",initMethod="init",destroyMethod="destroy")
2018-04-13
每个人想要学到的东西不一样吧,我只是想大概听一下,之前有一点MVC框架的基础,很快的把视频看完了,也对spring有了一个大概清晰的认识,很多知识点也有了了解,非常感谢老师。其实这门课程本来就只是带大家走一遍spring,为后面的深入学习打基础啦,老师这样讲挺好的
2018-04-11
可以在bean自己内调用
MoocApplicationContext context(或ApplicationContext) = (MoocApplicationContext) applicationContext.getBean("moocApplicationContext");
text.say();
MoocApplicationContext context(或ApplicationContext) = (MoocApplicationContext) applicationContext.getBean("moocApplicationContext");
text.say();
2018-04-11
2.实现ApplicationContextAware接口 就有setApplicationContext()方法,传入ApplicationContext参数
该参数相当于获取了ioc容器
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("com/imooc/aware/spring-aware.xml");
context == ApplicationContext传入的参数
该参数相当于获取了ioc容器
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("com/imooc/aware/spring-aware.xml");
context == ApplicationContext传入的参数
2018-04-11
不用junit
直接获取
ApplicationContext context = new ClassPathXmlApplicationContext("com/imooc/injection/spring-injection.xml");
InjectionService in = (InjectionService)context.getBean("injectionService");
in.save("imooc");
直接获取
ApplicationContext context = new ClassPathXmlApplicationContext("com/imooc/injection/spring-injection.xml");
InjectionService in = (InjectionService)context.getBean("injectionService");
in.save("imooc");
2018-04-10