Bean声明的三种方式: 1.@Component, @Service, @Repository,@Controller 用于声明一个组件,程序启动时会扫描这些组件,并创建实例. 2.在applicationContext-module.xml 中使用<bean/>来声明 3.在@Configuration标注的类中使用@Bean来声明Bean 第1种方式,常用于主模块中,也可以认为是项目的最顶层模块中的类.他们常于 @Resource,@Autowired @Inject 配合使用. 第2.…