According to Spring\'s documentation the way to use the TaskExecutor is as follows:
import org.springframework.core.task.TaskExecutor;
public class TaskExecutor
Try this method.
@Service
@Scope("prototype")
public invokeClass {
@Autowired
private ApplicationContext applicationContext;
public void methodName(TestRequest input){
TaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
taskExecutor.execute(new Runnable() {
public void run() {
applicationContext.getBean("testService", TestService.class).execute(input);
}
});
}
}