This commit is contained in:
ityouknow 2017-05-24 15:30:36 +08:00
parent eb928453ad
commit 57a68c39a6
16 changed files with 68 additions and 68 deletions

View File

@ -4,7 +4,7 @@ spring-cloud-starter
Spring cloud使用的各种示例以最简单、最实用为标准
- [spring-cloud-eureka](https://github.com/ityouknow/spring-cloud-starter/tree/master/spring-cloud-eureka)eureka server单机、双机、集群示例
- [service-producer-consumer](https://github.com/ityouknow/spring-cloud-starter/tree/master/service-producer-consumer)利用eureka实现服务提供与调用demo
- [eureka]-producer-consumer](https://github.com/ityouknow/spring-cloud-starter/tree/master/eureka]-producer-consumer)利用eureka实现服务提供与调用
- [spring-cloud-hystrix](https://github.com/ityouknow/spring-cloud-starter/tree/master/spring-cloud-hystrix)Hystrix熔断的使用示例
- [hystrix-dashboard-turbine](https://github.com/ityouknow/spring-cloud-starter/tree/master/hystrix-dashboard-turbine)熔断监控Hystrix Dashboard和Turbine的示例
- [spring-cloud-config-git](https://github.com/ityouknow/spring-cloud-starter/tree/master/spring-cloud-config-git)配置中心git版本

View File

@ -1,20 +1,20 @@
package com.neo.controller;
import com.neo.remote.HelloRemote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ConsumerController {
@Autowired
HelloRemote HelloRemote;
@RequestMapping("/hello/{name}")
public String index(@PathVariable("name") String name) {
return HelloRemote.hello(name);
}
package com.neo.controller;
import com.neo.remote.HelloRemote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ConsumerController {
@Autowired
HelloRemote HelloRemote;
@RequestMapping("/hello/{name}")
public String index(@PathVariable("name") String name) {
return HelloRemote.hello(name);
}
}

View File

@ -1,19 +1,19 @@
package com.neo.remote;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Created by summer on 2017/5/11.
*/
@FeignClient(name= "spring-cloud-producer")
public interface HelloRemote {
@RequestMapping(value = "/hello")
public String hello(@RequestParam(value = "name") String name);
}
package com.neo.remote;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Created by summer on 2017/5/11.
*/
@FeignClient(name= "spring-cloud-producer")
public interface HelloRemote {
@RequestMapping(value = "/hello")
public String hello(@RequestParam(value = "name") String name);
}

View File

@ -1,4 +1,4 @@
spring.application.name=spring-cloud-consumer
server.port=9001
eureka.client.serviceUrl.defaultZone=http://localhost:8000/eureka/
spring.application.name=spring-cloud-consumer
server.port=9001
eureka.client.serviceUrl.defaultZone=http://localhost:8000/eureka/

View File

@ -1,8 +1,8 @@
spring.application.name=spring-cloud-eureka
server.port=8000
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.client.serviceUrl.defaultZone=http://localhost:8000/eureka/
spring.application.name=spring-cloud-eureka
server.port=8000
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.client.serviceUrl.defaultZone=http://localhost:8000/eureka/

View File

@ -1,14 +1,14 @@
package com.neo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping("/hello")
public String index(@RequestParam String name) {
return "hello "+name+"this is first messge";
}
package com.neo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping("/hello")
public String index(@RequestParam String name) {
return "hello "+name+"this is first messge";
}
}

View File

@ -1,4 +1,4 @@
spring.application.name=spring-cloud-producer
server.port=9000
eureka.client.serviceUrl.defaultZone=http://localhost:8000/eureka/
spring.application.name=spring-cloud-producer
server.port=9000
eureka.client.serviceUrl.defaultZone=http://localhost:8000/eureka/