咻pur慢 2020-05-25
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");