//提供Restful风格服务
@RestController
public class DeptController {
@Autowired
private DeptService deptService;
@GetMapping("dept/query/{id}")
@HystrixCommand(fallbackMethod = "queryByIdOfHystrix")
public Dept queryById(@PathVariable("id") Long id){
Dept dept = deptService.queryById(id);
if (dept==null){
throw new RuntimeException("此id为空,查不到信息!!!");
}
return deptService.queryById(id);
}
public Dept queryByIdOfHystrix(@PathVariable("id") Long id){
return new Dept()