spring bean定义与加载方式

161 阅读1分钟

bean 定义

Xml


Annotation


Java based 


factoryBean


加载方式

xml加载
ApplicationContext applicationContext=
new ClassPathXmlApplicationContext("bean1.xml","bean2.xml");
<context:component-scan base-package="com.example"></context:component-scan>
java代码


Annotation扫描