<!-- 支持異步方法執行 --> <task:annotation-driven />
命名空間同時也加上:web
<?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:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd"> <context:component-scan base-package="cn.whbing.pro.web"/> <mvc:annotation-driven enable-matrix-variables="true" /> <!-- 支持異步方法執行 --> <task:annotation-driven /> <context:property-placeholder location="classpath:config/*.properties" /> <import resource="/spring/spring-config-dao.xml"/> </beans>
注意:spring
Spring事務<tx:annotation-driven/>
不要混淆。spring-mvc