com.deere.example.MainConfig Maven / Gradle / Ivy
/**
* Copyright 2019 Deere & Company
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
package com.deere.example;
import com.deere.isg.worktracker.servlet.MdcExecutor;
import com.deere.isg.worktracker.spring.ZombieExceptionHandler;
import com.deere.isg.worktracker.spring.ZombieHttpInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import java.util.concurrent.Executor;
@EnableWebMvc
@Configuration
public class MainConfig {
@Bean
public ZombieExceptionHandler zombieExceptionHandler() {
return new ZombieExceptionHandler();
}
@Bean
public RestTemplate zombieRestTemplate() {
RestTemplate restTemplate = new RestTemplate();
restTemplate.getInterceptors().add(new ZombieHttpInterceptor());
return restTemplate;
}
@Bean
public Executor mdcExecutor(Executor executor) {
return new MdcExecutor(executor);
}
}