WeatherService ws = (WeatherService) ctx.getBean("weatherService");
或
Map allWeatherServices = ctx.getBeansOfType(WeatherService.class);
《Spring 框架高级编程》学习笔记
最新推荐文章于 2021-07-27 17:46:50 发布
本文通过示例展示了如何使用Spring框架进行依赖注入,包括通过Bean名称获取WeatherService实例及通过类型匹配获取所有WeatherService实例的方法。
3574

被折叠的 条评论
为什么被折叠?



