spring底层学习demo
- set方法注入
- 构造方法注入
- singleton 单例获取
- prototype 每次请求都创建实例
- 定义、初始化、使用、销毁
- 待补充...
- BeanNameAware 可以获取容器中bean的名称
- ApplicationContextAware 当前的applicationContext, 这也可以调用容器的服务
- byName 根据属性名称自动装配-set注入
- byType 在容器中查找指定属性类型进行装配-set注入
- constructor 与byType类似-构造方法注入
- @Autowired 可以注解list和map;
- @Order(1) 改变注解顺序,list中有效
- @Qualifier("beanServiceImplOne") 一个接口有多个实现,指定其中一个
- 只要有finally,无论try中是否有return,finally中的代码都会被执行! 并且会在return之前被执行