首先,main函数在类路径下搜索到applicationContext.xml,类路径即在src目录下,我们在applicationContext.xml配置了id为“performer”的bean,当加载applicationContext.xml是,spring容器会将performer初始化,之后就可以用容器找到想要的bean,然后调用它的方法。
Spring3.x--声明一个简单Bean
最新推荐文章于 2021-07-22 16:49:17 发布
首先,main函数在类路径下搜索到applicationContext.xml,类路径即在src目录下,我们在applicationContext.xml配置了id为“performer”的bean,当加载applicationContext.xml是,spring容器会将performer初始化,之后就可以用容器找到想要的bean,然后调用它的方法。