28 lines
954 B
Java
28 lines
954 B
Java
package eu.dnetlib.repo.manager.config;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
@Configuration
|
|
@EnableAsync
|
|
public class AsyncConfiguration implements AsyncConfigurer {
|
|
|
|
@Override
|
|
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
|
|
return new AsyncUncaughtExceptionHandler() {
|
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
@Override
|
|
public void handleUncaughtException(Throwable throwable, Method method, Object... objects) {
|
|
logger.error("Async error", throwable);
|
|
}
|
|
};
|
|
}
|
|
}
|