技术栈

springboot工厂模式

西凉的悲伤
10 个月前
java·spring boot·后端·工厂模式·springboot工厂模式
SpringBoot工厂模式下面的示例展示了 SpringBoot 中如何使用工厂模式,该示例通过 ApplicationContext 直接获取 Spring 容器中所有 Animal 的 Bean,然后将它们存储在 animalMap 中,使用时直接从 Map 中获取实例。