为什么spring注解注入失败
1个回答
展开全部
注解扫描的包
<!-- 扫描指定package下所有带有如@controller,@services,@resource,并把所注释的注册为Spring Beans -->
<context:component-scan base-package="org.yanb.test" use-default-filters="false">
<context:include-filter type="regex" expression="org.test.main.control.*Control"/>
<context:include-filter type="regex" expression="org.test.main.facade.*Facade"/>
<context:include-filter type="regex" expression="org.test.main.service.*Service"/>
<context:include-filter type="regex" expression="org.test.main.dao.impl.*Impl"/>
<!--不扫描<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> -->
</context:component-scan>
<!-- 扫描指定package下所有带有如@controller,@services,@resource,并把所注释的注册为Spring Beans -->
<context:component-scan base-package="org.yanb.test" use-default-filters="false">
<context:include-filter type="regex" expression="org.test.main.control.*Control"/>
<context:include-filter type="regex" expression="org.test.main.facade.*Facade"/>
<context:include-filter type="regex" expression="org.test.main.service.*Service"/>
<context:include-filter type="regex" expression="org.test.main.dao.impl.*Impl"/>
<!--不扫描<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> -->
</context:component-scan>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询