com.zyy.common.config.HttpConfig Maven / Gradle / Ivy
package com.zyy.common.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zyy.common.util.HttpUtil;
import com.zyy.common.util.RedisUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
@Configuration
public class HttpConfig {
@Resource
private ObjectMapper objectMapper;
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
@Bean
public HttpUtil httpUtil() {
return new HttpUtil(restTemplate());
}
@Bean
public RedisUtil redisUtil() {
return new RedisUtil(objectMapper);
}
}