spring 配置异步要点(转载)
来源:互联网 发布:linux dd将img 编辑:程序博客网 时间:2024/06/05 00:50
3 */
4 @Async
5 public void sendNotificationMail(Map keyValue,String toAddress,String subJect,String templateName) {
6
7 String[] toList={toAddress}; sendNotificationMail(keyValue,toList,subJect,templateName) ;
8 }
但是这么做只是简单做法,大概积累3封邮件以后就会堵塞线程。
所以要加上配置文件<task:annotation-driven executor="myExecutor" scheduler="myScheduler" />
<task:executor id="myExecutor" pool-size="50" />
<task:scheduler id="myScheduler" pool-size="1000" />
但是只这么做,会报错
Caused by: org.xml.sax.SAXParseException: The prefix "task" for element "task:annotation-driven" is not bound.
核心还是在最后。
在配置文件的前面加上<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd"
default-lazy-init="true">
里面的task段落加上就OK了
- spring 配置异步要点(转载)
- spring 配置异步要点
- spring 配置异步要点 @Async
- spring 配置异步要点 @Async
- spring中异步配置
- Spring MVC国际化配置(转载)
- 转载 (一)spring配置远程调用
- (转载)spring多数据源配置
- 转载(springmvc+spring+mabatis)配置
- struts1、spring、hibernate整合配置要点
- spring配置详解-连接池配置(转载)
- spring配置详解-连接池配置(转载)
- spring配置详解-连接池配置(转载)
- spring配置详解-连接池配置(转载)
- spring配置详解-连接池配置(转载)
- Spring开启@Async异步方法(javaconfig配置)
- [转载]spring MVC配置详解
- (转载)C++的一些要点
- 在iOS上实现一个简单的日历控件
- Ubuntu12安装
- JBoss配置HTTPS安全连接
- ubuntu下快速安装adb,fastboot的方法
- 无线AP与无线路由器的区别
- spring 配置异步要点(转载)
- 我回来了
- hadoop集群搭建
- 如何区分一个程序员是“老手“还是“新手“?
- 针对从ios5/6 升级到ios7 的viewcontroller的 生命周期调整说明;
- 匹配URL或者网址
- NYOJ 6 喷水装置(一)
- 视频内容是如何在互联网进行分发的
- UVALive 3720 Highways(组合计数、递推)