Spring3 component-scan 引入多个注解包

<context:component-scan base-package="com.mjwise" use-default-filters="true">
    <!--<context:include-filter type="assignable" expression="com.mjwise.dao.UserDao"/>-->
    <!--<context:include-filter type="assignable" expression="com.mjwise.service.impl.UserServiceImpl"/>-->
    <!--<context:include-filter type="assignable" expression="com.mjwise.controller.UserController"/>-->
    <!--<context:include-filter type="regex" expression="com\.mjwise\.dao.*"/>-->
    <context:include-filter type="regex" expression="\.dao.*"/>
    <context:include-filter type="regex" expression=".service\.impl.*"/>
    <context:include-filter type="regex" expression=".controller.*"/>
</context:component-scan>

此外需要注意use-default-filters=”true”

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页