com.github.unclecatmyself.task.DataAsynchronousTask Maven / Gradle / Ivy
package com.github.unclecatmyself.task;
import com.github.unclecatmyself.bootstrap.data.InChatToDataBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.concurrent.Future;
/**
* Created by MySelf on 2018/12/3.
*/
@Component
public class DataAsynchronousTask {
@Autowired
InChatToDataBaseService inChatToDataBaseService;
@Async
public Future writeData(Map maps) throws Exception {
//异步写入数据
return new AsyncResult<>(inChatToDataBaseService.writeMapToDB(maps));
}
}