Spring 相关

启动Spring

xml方式生成bean

ClassPathXmlApplicationContext applicationContext=new ClassPathXmlApplicationContext(spring.xml);

注解方式生成bean

AnnotationConfigApplicationContext applicationContext=new AnnotationConfigApplicationContext(AppConfig.class);

getBean

userService userService=applicationContext.getBean("userServcie",userService.class);

 

上一篇:Spring Cloud —— 动态创建FeignClient实例


下一篇:整合SSM框架