我的中软国际实习Day16
springcloude
UserClient
package com.zr.client;
import com.zr.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@FeignClient(value = "zr-provider",fallback = UserClientFallback.class)
public interface UserClient {
@RequestMapping("user/{id}")
User queryById(@PathVariable("id")Long id);
}
UserClientFailback
package com.zr.client;
import com.zr.pojo.User;
import org.springframework.stereotype.Component;
@Component
public class UserClientFallback implements UserClient{
@Override
public User queryById(Long id) {
User user=new User()<