0

我需要将这些目录添加到我的应用程序中。这实际上有效:

<context:component-scan base-package="web.controllers"/>
<context:component-scan base-package="web.controllers.gec"/>
<context:component-scan base-package="web.controllers.gec.costs"/>
<context:component-scan base-package="web.controllers.gec.pay"/>

Bu我想知道我怎么能用一行代码做到这一点。就像是:

 <context:component-scan base-package="web.controllers">
       <context:include-filter type="regex" expression=".*.*"/>
 </context:component-scan>

有什么帮助或想法吗?非常感谢!

4

2 回答 2

1
<!-- The controllers are autodetected POJOs labeled with the @Controller annotation. -->
<context:component-scan base-package="com.company.app" use-default-filters="false">
    <context:include-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
</context:component-scan>
于 2013-01-25T16:00:40.813 回答
0

抱歉,但实际上我之前发布的解决方案可以正常工作:

<context:component-scan base-package="web.controllers">
   <context:include-filter type="regex" expression=".*.*"/>
</context:component-scan>
于 2013-01-25T13:49:28.413 回答