類上面加注解 () 中默認填寫類對應 bean的 id
配置文件中 <context:component-scan base-package resource-pattern>
base-package 中可包含多個包,可通過‘空格’、‘,’ 分隔
<!--指定ioc容器包掃描的包
可以通過 resource-pattern 指定掃描的資源
如 resource-pattern="dao/*.class"
子節點 context:exclude-filter 不包含哪些
子節點 context:include-filter 一般要和 use-default-filters(默認true) 屬性配合使用
子節點下的屬性
type:1、annotation 注解的類名 import上的那個
2、assignable bean類的類名
-->
<context:component-scan base-package="com.springTest.beanAnnotation"
use-default-filters="false">
<context:include-filter type="assignable"
expression="com.springTest.beanAnnotation.controller"/>
</context:component-scan>
使用@Autowire 裝配bean
autowire注解裝備bean.png
泛型
泛型依賴注入.png