@Async

命名空间

xmlns:task="http://www.springframework.org/schema/task" 

 

启用@Async注解

 

<task:annotation-driven executor="myExecutor"/>//启用async注解

<task:executor id="myExecutor" pool-size="5"/>

 

注解应用

@Async
void doSomething(String s) {
    // this will be executed asynchronously
}

 

@Async
Future<String> returnSomething(int i) {
    // this will be executed asynchronously
}

 

 

 

你可能感兴趣的:(async)