mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Merge code from upstream
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>alicloud-ans-spring-cloud-starter</artifactId>
|
||||
<artifactId>spring-cloud-starter-alicloud-ans</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
|
@@ -24,11 +24,11 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
* @author xiaolongzuo
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients(basePackages = {"com.alibaba.cloud.examples"})
|
||||
@EnableFeignClients(basePackages = { "com.alibaba.cloud.examples" })
|
||||
public class ConsumerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ConsumerApplication.class, args);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ConsumerApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
@FeignClient(value = "ans-provider")
|
||||
public interface EchoService {
|
||||
|
||||
@RequestMapping(path = "echo/{str}")
|
||||
String echo(@RequestParam("str") String param);
|
||||
@RequestMapping(path = "echo/{str}")
|
||||
String echo(@RequestParam("str") String param);
|
||||
|
||||
}
|
||||
|
@@ -29,18 +29,18 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
public class HomeController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HomeController.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HomeController.class);
|
||||
|
||||
@Autowired
|
||||
private EchoService echoService;
|
||||
@Autowired
|
||||
private EchoService echoService;
|
||||
|
||||
@RequestMapping(value = "/", method = RequestMethod.GET, produces = "application/json")
|
||||
public String home() {
|
||||
LOGGER.info("-----------------consumer调用开始-----------------");
|
||||
String param = "Nice to meet you.";
|
||||
LOGGER.info("消费者传递参数:" + param);
|
||||
String result = echoService.echo(param);
|
||||
LOGGER.info("收到提供者响应:" + result);
|
||||
return param + "<br>" + result;
|
||||
}
|
||||
@RequestMapping(value = "/", method = RequestMethod.GET, produces = "application/json")
|
||||
public String home() {
|
||||
LOGGER.info("-----------------consumer调用开始-----------------");
|
||||
String param = "Nice to meet you.";
|
||||
LOGGER.info("消费者传递参数:" + param);
|
||||
String result = echoService.echo(param);
|
||||
LOGGER.info("收到提供者响应:" + result);
|
||||
return param + "<br>" + result;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user