Files
Hui-s-notebook/logseq-java/pages/BeanDefination.md
2024-02-02 00:12:49 +08:00

15 lines
712 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
- 用来表示Bean定义
- Spring根据BeanDefination来创建Bean对象有很多属性来描述Bean
- beanClass
- 表示一个Bean的类型根据此属性实例化得到对象
- scope
- 表示一个Bean的作用域
- isLazy
- 表示是否需要懒加载,原型不起作用
- dependsOn
- 表示一个Bean再创建前需要依赖的其他Bean一个Bean创建前这些需要创建好
- primary
- 表示一个Bean是主Bean一个类型可以存在多个Bean依赖注入是有主Bean会选择主Bean注入
- initMethodName
- 一个Bean的初始化方法初始化阶段会调用这个方法可以自定义逻辑对这个加工
- @Component@Bean、\<bean />都会解析为BeanDefinatino