Spring3 以后的版本内置了@Async ,它作用在public的方法上,对应的类需要添加@Component注解。
举例子:
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@Component
public class AsyncMethondService {
@Async
public void testAsyncMethond(String param){
System.out.println("异步调用")
}
}