package com.changhong.epc.config.datasource; import com.codingapi.tx.config.service.TxManagerTxUrlService; import com.codingapi.tx.netty.service.TxManagerHttpRequestService; import com.lorne.core.framework.utils.http.HttpUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration @Slf4j public class TxManagerConfig { @Value("http://iemsoft:iemsoft.cn@10.4.32.149:8999/tx/manager/") private String url; @Bean public TxManagerTxUrlService txManagerTxUrlService(){ return ()->url; } @Bean public TxManagerHttpRequestService txManagerHttpRequestService(){ return new TxManagerHttpRequestService(){ @Override public String httpGet(String url) { log.debug("httpGet-start:{}", url); String res = HttpUtils.get(url); log.debug("httpGet-end:{}", url); return res; } @Override public String httpPost(String url, String params) { log.debug("httpPost-start:{}@{}", url, params); String res = HttpUtils.post(url,params); log.debug("httpPost-end:{}@{}", url, params); return res; } }; } }