@@ -8,6 +8,7 @@ import org.apache.commons.lang3.exception.ExceptionUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import javax.annotation.PostConstruct; | |||||
import java.text.MessageFormat; | import java.text.MessageFormat; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.Map; | import java.util.Map; | ||||
@@ -26,15 +27,11 @@ public class OkHttpUtil { | |||||
@Autowired private OkHttpClient okHttpClient; | @Autowired private OkHttpClient okHttpClient; | ||||
private static OkHttpUtil okHttpUtil; | private static OkHttpUtil okHttpUtil; | ||||
/** | |||||
* spring会自动从ioc容器当中根据OkHttpUtil类型找到okHttpUtil,当做参数传进来 | |||||
* | |||||
*/ | |||||
@Autowired | |||||
public void setOkHttpUtil(OkHttpUtil okHttpUtil) { | |||||
this.okHttpUtil = okHttpUtil; | |||||
} | |||||
@PostConstruct | |||||
public void init() { | |||||
okHttpUtil = this; | |||||
} | |||||
/** | /** | ||||
* 根据map获取get请求参数 | * 根据map获取get请求参数 | ||||
* | * | ||||
@@ -6,6 +6,7 @@ import org.springframework.data.redis.core.RedisTemplate; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.util.CollectionUtils; | import org.springframework.util.CollectionUtils; | ||||
import javax.annotation.PostConstruct; | |||||
import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
@@ -29,9 +30,10 @@ public class RedisUtil { | |||||
* spring会自动从ioc容器当中根据RedisUtil类型找到redisUtil,当做参数传进来 | * spring会自动从ioc容器当中根据RedisUtil类型找到redisUtil,当做参数传进来 | ||||
* | * | ||||
*/ | */ | ||||
@Autowired | |||||
public void setRedisUtil(RedisUtil redisUtil) { | |||||
this.redisUtil = redisUtil; | |||||
@PostConstruct | |||||
public void init() { | |||||
redisUtil = this; | |||||
} | } | ||||
// =============================common============================ | // =============================common============================ | ||||
/** | /** | ||||