195-如何获取Spring容器中的对象?
1)SpringBoot框架获取容器中的对象
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
RestTemplate bean = (RestTemplate) context.getBean("restTemplate");
2)Spirng框架如何获取容器中的对象呢?
ApplicationContext context = new ClassPathXmlApplicationContext("application.xml")
RestTemplate bean = (RestTemplate) context.getBean("restTemplate");