2012-03-14 47 views

回答

2

可配置組件掃描你怎麼樣(順便說一句:你可以有幾個組件掃描)

<context:component-scan base-package="org.example" use-default-filters="false"> 
    <context:include-filter type="regex" expression=".*Dao"/> 
</context:component-scan> 

這個例子將創建豆類所有類泰德匹配的正則表達式和位於基礎包中。

@查看S pring Reference Chapter 3.10.3 Using filters to customize scanning

+0

啊哈!這就是我需要的。顯然我並沒有在正確的位置「尋找」(我的一些daos是在不同的包中)。 – 2012-03-16 16:24:40