spring 配置

在context中配置

如:在base-package指明一個包:

<component-scan>

表明cn.gacl.java包及其子包中,如果某個類的頭上帶有特定的註解

@Component,@Repository,@Service,@Controller,就會將這個對象作為Bean註冊進Spring容器。

在<component-scan>中指定多個包:

<component-scan>

多個包逗號隔開。