修改添加连接池
parent
b59596d4ba
commit
587f61aab5
|
@ -0,0 +1,16 @@
|
||||||
|
package com.muyu.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.domain.Source;
|
||||||
|
import com.muyu.remote.factory.SourceFactory;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
@EnableFeignClients
|
||||||
|
@FeignClient(value = "cloud-etl-datasources",fallbackFactory = SourceFactory.class )
|
||||||
|
public interface SourceRemote {
|
||||||
|
@GetMapping("datasources/{id}")
|
||||||
|
public Result<Source> queryById(@PathVariable("id") Long id);
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.remote.factory;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.domain.Source;
|
||||||
|
import com.muyu.remote.SourceRemote;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class SourceFactory implements FallbackFactory<SourceRemote> {
|
||||||
|
@Override
|
||||||
|
public SourceRemote create(Throwable cause) {
|
||||||
|
return new SourceRemote() {
|
||||||
|
@Override
|
||||||
|
public Result<Source> queryById(Long id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue