解决:java.lang.ClassNotFoundException: edu.emory.mathcs.backport.java.util.concurrent.Executor

spring线程池配置如下:

	 
	        
	         
	    
	      
	         
	      
	

解决办法:本解决办法无需引入额外edu.emory.mathcs.backport.java.util.concurrent.Executor的jar包。只需要使用jdk自带的CompletionService包装线程执行器使用即可。

            代码如下:

        @Resource
	private TaskExecutor taskExecutor2;
	
	 CompletionService completionService = new ExecutorCompletionService(taskExecutor2);
		 
			Future> future = completionService.submit(new Callable>(){
				public List call() throws Exception {
					return (List) tmpSqlMapClientTemplate.queryForList(
							"Cont.getContsByKeys", params);
				}});
			resultLst.addAll(future.get());


你可能感兴趣的:(spring)