配置通过静态工厂方法创建的bean public class StaticBookFactory { //静态工厂方法: public static Book getBook(String bookName){ System.out.println("静态工厂方法调用..."); Book book = new Book(); book.setBookName(bookName+"_static"); book.setAuthor(new Person()); bo…
仓库地址 w4ngzhen/springboot-simple-guide: This is a project that guides SpringBoot users to get started quickly through a series of examples (github.com) Chapter01-如何用Spring框架声明Bean 前言 在上一章中,我们已经掌握了Spring最基本的使用方式: 通过使用@Component注解标记我们的类作为一个Bean组件. 使用Spr…