開發框架:Spring4+Mybatis3+Jta(atomikos)spring
運行單元測試報如下錯誤:spring-mvc
最終排查發現是<context:component-scan/>的緣由致使。mvc
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.3.xsd" default-autowire="byName">
<!-- 1.掃描註解-->
<context:component-scan base-package="controller.*"></context:component-scan>
<context:component-scan base-package="mapper.*"></context:component-scan>
<context:component-scan base-package="model.*"></context:component-scan>
<context:component-scan base-package="service.impl"></context:component-scan>
<!--2.註解驅動-->
<mvc:annotation-driven></mvc:annotation-driven>
</beans>
base-package="controller.*"有誤,應爲base-package="controller"