将公司的不同业务分成一个一个的服务,服务直接可以相互调用,其最大的好处就是不同服务可以用不同语言写,比如有的服务用java写,有的用python写,他们之间使用json进行数据传输,因为json是跨语言跨平台的
使得业务能力大大提高
总结:
- 调用的话使用httpUtils工具类或springboot封装的restTemplate
// 去远程调用用户服务验证
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity("http://ssoserver.com:6570/userInfo?token=" + token, String.class);
String body = forEntity.getBody();
- 数据传输的话用json