vmaps 1 mese fa
parent
commit
0bbed73bf9
35 ha cambiato i file con 129 aggiunte e 385 eliminazioni
  1. 0 4
      config/pom.xml
  2. 0 3
      config/src/main/resources/application.properties
  3. 0 7
      config/src/main/resources/properties/gateway-default.properties
  4. 0 1
      config/src/main/resources/properties/hystrix-dashboard-default.properties
  5. 0 12
      config/src/main/resources/properties/order-default.properties
  6. 4 0
      config/src/main/resources/properties/service1-default.properties
  7. 4 0
      config/src/main/resources/properties/service2-default.properties
  8. 0 7
      config/src/main/resources/properties/turbine-default.properties
  9. 0 9
      config/src/main/resources/properties/user-default.properties
  10. 4 10
      gateway/pom.xml
  11. 3 2
      gateway/src/main/java/com/wangsong/GatewayApplication.java
  12. 5 0
      gateway/src/main/resources/bootstrap.properties
  13. 0 42
      hystrix-dashboard/pom.xml
  14. 0 15
      hystrix-dashboard/src/main/java/com/wangsong/HystrixDashboardApplication.java
  15. 0 12
      hystrix-dashboard/src/main/resources/bootstrap.properties
  16. 0 33
      order/src/main/java/com/wangsong/OrderApplication.java
  17. 0 45
      order/src/main/java/com/wangsong/order/controller/OrderController.java
  18. 7 9
      pom.xml
  19. 1 1
      user-api/pom.xml
  20. 5 5
      user-api/src/main/java/com/wangsong/user/api/UserAPI.java
  21. 9 26
      user/pom.xml
  22. 2 16
      user/src/main/java/com/wangsong/UserApplication.java
  23. 22 0
      service1/src/main/java/com/wangsong/test1/controller/Test1Controller.java
  24. 2 1
      user/src/main/resources/bootstrap.properties
  25. 0 0
      service1/src/main/resources/logback-spring.xml
  26. 0 0
      service1/src/main/resources/mybatis-config.xml
  27. 7 28
      order/pom.xml
  28. 19 0
      service2/src/main/java/com/wangsong/Service2Application.java
  29. 34 0
      service2/src/main/java/com/wangsong/test2/controller/Test2Controller.java
  30. 1 1
      order/src/main/resources/bootstrap.properties
  31. 0 0
      service2/src/main/resources/logback-spring.xml
  32. 0 44
      turbine/pom.xml
  33. 0 18
      turbine/src/main/java/com/wangsong/TurbineApplication.java
  34. 0 12
      turbine/src/main/resources/bootstrap.properties
  35. 0 22
      user/src/main/java/com/wangsong/user/controller/UserController.java

+ 0 - 4
config/pom.xml

@@ -22,10 +22,6 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-actuator</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
-        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 0 - 3
config/src/main/resources/application.properties

@@ -13,7 +13,4 @@ spring.cloud.consul.port= 8500
 spring.cloud.consul.discovery.healthCheckPath= /actuator/health
 spring.cloud.consul.discovery.healthCheckInterval= 5s
 
-management.server.port= 8081
-management.endpoints.web.exposure.include= *
-#暴露bus-refresh节点,通过此节点刷新配置
 

+ 0 - 7
config/src/main/resources/properties/gateway-default.properties

@@ -3,12 +3,5 @@ server.port=1101
 spring.cloud.gateway.discovery.locator.enabled=true
 spring.cloud.gateway.discovery.locator.lowerCaseServiceId=true
 
-spring.rabbitmq.host=localhost
-spring.rabbitmq.port=5672
-spring.rabbitmq.username=guest
-spring.rabbitmq.password=guest
-
-spring.zipkin.sender.type= rabbit
-spring.sleuth.sampler.percentage=1.0
 
 

+ 0 - 1
config/src/main/resources/properties/hystrix-dashboard-default.properties

@@ -1 +0,0 @@
-server.port=1301

+ 0 - 12
config/src/main/resources/properties/order-default.properties

@@ -1,12 +0,0 @@
-server.port=2002
-
-spring.rabbitmq.host=localhost
-spring.rabbitmq.port=5672
-spring.rabbitmq.username=guest
-spring.rabbitmq.password=guest
-spring.zipkin.sender.type= rabbit
-spring.sleuth.sampler.percentage=1.0
-
-## Ë¢ÐÂʱ£¬¹Ø±Õ°²È«ÑéÖ¤
-management.security.enabled=false
-

+ 4 - 0
config/src/main/resources/properties/service1-default.properties

@@ -0,0 +1,4 @@
+server.port=2001
+
+
+

+ 4 - 0
config/src/main/resources/properties/service2-default.properties

@@ -0,0 +1,4 @@
+server.port=2002
+
+
+

+ 0 - 7
config/src/main/resources/properties/turbine-default.properties

@@ -1,7 +0,0 @@
-server.port=8989
-management.port=8990
-
-turbine.app-config=user,order
-turbine.instanceUrlSuffix=hystrix.stream
-turbine.cluster-name-expression="default"
-turbine.combine-host-port=true

+ 0 - 9
config/src/main/resources/properties/user-default.properties

@@ -1,9 +0,0 @@
-server.port=2001
-
-spring.rabbitmq.host=localhost
-spring.rabbitmq.port=5672
-spring.rabbitmq.username=guest
-spring.rabbitmq.password=guest
-spring.zipkin.sender.type= rabbit
-spring.sleuth.sampler.percentage=0.512
-

+ 4 - 10
gateway/pom.xml

@@ -20,7 +20,7 @@
         </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
+            <artifactId>spring-cloud-starter-bootstrap</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
@@ -28,20 +28,14 @@
         </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
+            <artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-actuator</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-zipkin</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.amqp</groupId>
-            <artifactId>spring-rabbit</artifactId>
-        </dependency>
+
+
     </dependencies>
     <build>
         <plugins>

+ 3 - 2
gateway/src/main/java/com/wangsong/GatewayApplication.java

@@ -1,11 +1,12 @@
 package com.wangsong;
 
 import org.springframework.boot.SpringApplication;
-import org.springframework.cloud.client.SpringCloudApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 
 
-@SpringCloudApplication
+@SpringBootApplication
+@EnableDiscoveryClient  // 如果你用的是 Nacos、Eureka 等注册中心
 public class GatewayApplication {
 
     public static void main(String[] args) {

+ 5 - 0
gateway/src/main/resources/bootstrap.properties

@@ -1,5 +1,8 @@
 spring.application.name=gateway
 
+
+
+
 spring.cloud.consul.host= 127.0.0.1
 spring.cloud.consul.port= 8500
 spring.cloud.consul.discovery.healthCheckPath= /actuator/health
@@ -10,3 +13,5 @@ spring.cloud.config.discovery.serviceId=config
 spring.cloud.config.discovery.enabled=true
 spring.cloud.config.profile=default
 spring.cloud.config.label=master
+
+

+ 0 - 42
hystrix-dashboard/pom.xml

@@ -1,42 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>com.wangsong</groupId>
-        <artifactId>springcloud-app</artifactId>
-        <version>0.0.1-SNAPSHOT</version>
-    </parent>
-    <artifactId>hystrix-dashboard</artifactId>
-    <packaging>jar</packaging>
-    <description>Demo project for Spring Boot</description>
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-config</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-consul-discovery</artifactId>
-        </dependency>
-    </dependencies>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-</project>

+ 0 - 15
hystrix-dashboard/src/main/java/com/wangsong/HystrixDashboardApplication.java

@@ -1,15 +0,0 @@
-package com.wangsong;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.cloud.client.SpringCloudApplication;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
-
-@EnableHystrixDashboard
-@SpringCloudApplication
-@EnableDiscoveryClient
-public class HystrixDashboardApplication {
-    public static void main(String[] args) {
-        SpringApplication.run(HystrixDashboardApplication.class, args);
-    }
-}

+ 0 - 12
hystrix-dashboard/src/main/resources/bootstrap.properties

@@ -1,12 +0,0 @@
-spring.application.name=hystrix-dashboard
-
-spring.cloud.consul.host= 127.0.0.1
-spring.cloud.consul.port= 8500
-spring.cloud.consul.discovery.healthCheckPath= /actuator/health
-spring.cloud.consul.discovery.healthCheckInterval= 5s
-
-spring.cloud.config.fail-fast=true
-spring.cloud.config.discovery.serviceId=config
-spring.cloud.config.discovery.enabled=true
-spring.cloud.config.profile=default
-spring.cloud.config.label=master

+ 0 - 33
order/src/main/java/com/wangsong/OrderApplication.java

@@ -1,33 +0,0 @@
-package com.wangsong;
-
-import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.web.servlet.ServletRegistrationBean;
-import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-import org.springframework.context.annotation.Bean;
-
-@EnableCircuitBreaker
-@EnableFeignClients
-@EnableDiscoveryClient
-@SpringBootApplication
-public class OrderApplication {
-
-    public static void main(String[] args) {
-
-        SpringApplication.run(OrderApplication.class, args);
-
-    }
-
-    @Bean
-    public ServletRegistrationBean getServlet() {
-        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
-        ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
-        registrationBean.setLoadOnStartup(1);
-        registrationBean.addUrlMappings("/hystrix.stream");
-        registrationBean.setName("HystrixMetricsStreamServlet");
-        return registrationBean;
-    }
-}

+ 0 - 45
order/src/main/java/com/wangsong/order/controller/OrderController.java

@@ -1,45 +0,0 @@
-package com.wangsong.order.controller;
-
-
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
-import com.wangsong.user.api.UserAPI;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-
-/**
- * 定时任务 controller
- *
- * @author ty
- * @date 2015年1月14日
- */
-@Controller
-@RequestMapping("/order")
-public class OrderController {
-
-    @Autowired
-    private UserAPI systemAPI;
-
-    //http://127.0.0.1:1101/order/order/get?text=12
-    @RequestMapping("/get")
-    @ResponseBody
-    public Object get(String text) {
-        return systemAPI.getUser(text);
-    }
-
-    @HystrixCommand(fallbackMethod = "test")
-    @RequestMapping(value = "/test")
-    @ResponseBody
-    public String list() {
-        return "1";
-    }
-
-
-    public String test() {
-        return "2";
-    }
-
-
-}

+ 7 - 9
pom.xml

@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.2.5.RELEASE</version>
+        <version>3.5.0</version> <!-- 推荐最新3.2.x -->
         <relativePath/> <!-- lookup parent from repository -->
     </parent>
     <groupId>com.wangsong</groupId>
@@ -14,12 +14,10 @@
     <url>http://maven.apache.org</url>
     <modules>
         <module>gateway</module>
-        <module>user</module>
+        <module>service1</module>
         <module>config</module>
-        <module>user-api</module>
-        <module>order</module>
-        <module>hystrix-dashboard</module>
-        <module>turbine</module>
+        <module>service1-api</module>
+        <module>service2</module>
     </modules>
     <!-- 设定主仓库,按设定顺序进行查找。 -->
     <repositories>
@@ -39,20 +37,20 @@
     </pluginRepositories>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <java.version>1.8</java.version>
+        <java.version>17</java.version>
     </properties>
     <dependencyManagement>
         <dependencies>
             <dependency>
                 <groupId>org.springframework.cloud</groupId>
                 <artifactId>spring-cloud-dependencies</artifactId>
-                <version>Hoxton.SR3</version>
+                <version>2025.0.0</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
             <dependency>
                 <groupId>com.wangsong</groupId>
-                <artifactId>user-api</artifactId>
+                <artifactId>service1-api</artifactId>
                 <version>0.0.1-SNAPSHOT</version>
             </dependency>
         </dependencies>

+ 1 - 1
user-api/pom.xml

@@ -6,7 +6,7 @@
 		<artifactId>springcloud-app</artifactId>
 		<version>0.0.1-SNAPSHOT</version>
 	</parent>
-	<artifactId>user-api</artifactId>
+	<artifactId>service1-api</artifactId>
 	<packaging>jar</packaging>
 
 	<url>http://maven.apache.org</url>

+ 5 - 5
user-api/src/main/java/com/wangsong/user/api/UserAPI.java

@@ -1,16 +1,16 @@
-package com.wangsong.user.api;
+package com.wangsong.test1.api;
 
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
-@FeignClient("user")
-public interface UserAPI {
+@FeignClient("service1/test1")
+public interface Test1API {
 
 
-    @RequestMapping(value = "/user/getUser", method = RequestMethod.POST)
-    String getUser(@RequestParam String user);
+    @RequestMapping(value = "/test", method = RequestMethod.POST)
+    String test(@RequestParam String test);
 
 
 }

+ 9 - 26
user/pom.xml

@@ -6,7 +6,7 @@
         <artifactId>springcloud-app</artifactId>
         <version>0.0.1-SNAPSHOT</version>
     </parent>
-    <artifactId>user</artifactId>
+    <artifactId>service1</artifactId>
     <packaging>jar</packaging>
     <url>http://maven.apache.org</url>
     <dependencies>
@@ -14,10 +14,7 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-aop</artifactId>
-        </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
@@ -32,46 +29,32 @@
         </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
+            <artifactId>spring-cloud-starter-loadbalancer</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-openfeign</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context-support</artifactId>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-actuator</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
-        </dependency>
 
         <dependency>
             <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-zipkin</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.amqp</groupId>
-            <artifactId>spring-rabbit</artifactId>
+            <artifactId>spring-cloud-starter-bootstrap</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
-        </dependency>
+
+
 
         <dependency>
             <groupId>com.wangsong</groupId>
-            <artifactId>user-api</artifactId>
+            <artifactId>service1-api</artifactId>
         </dependency>
     </dependencies>
     <build>

+ 2 - 16
user/src/main/java/com/wangsong/UserApplication.java

@@ -1,40 +1,26 @@
 package com.wangsong;
 
-import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.servlet.ServletRegistrationBean;
 import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.client.loadbalancer.LoadBalanced;
 import org.springframework.cloud.context.config.annotation.RefreshScope;
-import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
 import org.springframework.web.client.RestTemplate;
 
 
-@EnableCircuitBreaker
 @EnableFeignClients
 @EnableDiscoveryClient
 @SpringBootApplication
-public class UserApplication {
+public class Service1Application {
 
 	public static void main(String[] args) {
 
-		SpringApplication.run(UserApplication.class, args);
+		SpringApplication.run(Service1Application.class, args);
 
 	}
 
-	@Bean
-	public ServletRegistrationBean getServlet() {
-		HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
-		ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
-		registrationBean.setLoadOnStartup(1);
-		registrationBean.addUrlMappings("/hystrix.stream");
-		registrationBean.setName("HystrixMetricsStreamServlet");
-		return registrationBean;
-	}
-
 }

+ 22 - 0
service1/src/main/java/com/wangsong/test1/controller/Test1Controller.java

@@ -0,0 +1,22 @@
+package com.wangsong.test1.controller;
+//
+
+import com.wangsong.test1.api.Test1API;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+
+@Controller
+@RequestMapping("/test1")
+public class Test1Controller implements Test1API {
+
+    @RequestMapping(value = "/test", method = RequestMethod.POST)
+    @ResponseBody
+    public String test(String test) {
+        return test;
+    }
+
+
+}

+ 2 - 1
user/src/main/resources/bootstrap.properties

@@ -1,4 +1,4 @@
-spring.application.name=user
+spring.application.name=service1
 
 spring.cloud.consul.host= 127.0.0.1
 spring.cloud.consul.port= 8500
@@ -10,3 +10,4 @@ spring.cloud.config.discovery.serviceId=config
 spring.cloud.config.discovery.enabled=true
 spring.cloud.config.profile=default
 spring.cloud.config.label=master
+

order/src/main/resources/logback-spring.xml → service1/src/main/resources/logback-spring.xml


user/src/main/resources/mybatis-config.xml → service1/src/main/resources/mybatis-config.xml


+ 7 - 28
order/pom.xml

@@ -6,14 +6,14 @@
         <artifactId>springcloud-app</artifactId>
         <version>0.0.1-SNAPSHOT</version>
     </parent>
-    <artifactId>order</artifactId>
+    <artifactId>service2</artifactId>
     <packaging>jar</packaging>
     <url>http://maven.apache.org</url>
 
     <dependencies>
         <dependency>
             <groupId>com.wangsong</groupId>
-            <artifactId>user-api</artifactId>
+            <artifactId>service1-api</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -21,7 +21,7 @@
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-aop</artifactId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -37,41 +37,20 @@
         </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-openfeign</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context-support</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
+            <artifactId>spring-cloud-starter-bootstrap</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
+            <artifactId>spring-cloud-starter-loadbalancer</artifactId>
         </dependency>
-
         <dependency>
             <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-zipkin</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.amqp</groupId>
-            <artifactId>spring-rabbit</artifactId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
         </dependency>
 
         <dependency>
             <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
+            <artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
         </dependency>
 
     </dependencies>

+ 19 - 0
service2/src/main/java/com/wangsong/Service2Application.java

@@ -0,0 +1,19 @@
+package com.wangsong;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+@EnableFeignClients
+@EnableDiscoveryClient
+@SpringBootApplication
+public class Service2Application {
+
+    public static void main(String[] args) {
+
+        SpringApplication.run(Service2Application.class, args);
+
+    }
+
+}

+ 34 - 0
service2/src/main/java/com/wangsong/test2/controller/Test2Controller.java

@@ -0,0 +1,34 @@
+package com.wangsong.test2.controller;
+
+
+import com.wangsong.test1.api.Test1API;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+
+/**
+ * 定时任务 controller
+ *
+ * @author ty
+ * @date 2015年1月14日
+ */
+@Controller
+@RequestMapping("/test2")
+public class Test2Controller {
+
+    @Autowired
+    private Test1API systemAPI;
+
+    //http://127.0.0.1:1101/service2/test2/test?text=12
+    //http://127.0.0.1:2002/test2/test?text=12
+    @RequestMapping("/test")
+    @ResponseBody
+    public Object get(String text) {
+        return systemAPI.test(text);
+    }
+
+
+
+}

+ 1 - 1
order/src/main/resources/bootstrap.properties

@@ -1,4 +1,4 @@
-spring.application.name=order
+spring.application.name=service2
 
 spring.cloud.consul.host= 127.0.0.1
 spring.cloud.consul.port= 8500

user/src/main/resources/logback-spring.xml → service2/src/main/resources/logback-spring.xml


+ 0 - 44
turbine/pom.xml

@@ -1,44 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>com.wangsong</groupId>
-        <artifactId>springcloud-app</artifactId>
-        <version>0.0.1-SNAPSHOT</version>
-    </parent>
-    <artifactId>turbine</artifactId>
-    <packaging>jar</packaging>
-    <description>Demo project for Spring Boot</description>
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-turbine</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.cloud</groupId>
-                    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-consul-discovery</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-config</artifactId>
-        </dependency>
-    </dependencies>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-</project>

+ 0 - 18
turbine/src/main/java/com/wangsong/TurbineApplication.java

@@ -1,18 +0,0 @@
-package com.wangsong;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.cloud.client.SpringCloudApplication;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.cloud.netflix.turbine.EnableTurbine;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-@EnableAutoConfiguration
-@EnableTurbine
-@EnableDiscoveryClient
-public class TurbineApplication {
-    public static void main(String[] args) {
-        SpringApplication.run(TurbineApplication.class, args);
-    }
-}

+ 0 - 12
turbine/src/main/resources/bootstrap.properties

@@ -1,12 +0,0 @@
-spring.application.name=turbine
-
-spring.cloud.consul.host= 127.0.0.1
-spring.cloud.consul.port= 8500
-spring.cloud.consul.discovery.healthCheckPath= /actuator/health
-spring.cloud.consul.discovery.healthCheckInterval= 5s
-
-spring.cloud.config.fail-fast=true
-spring.cloud.config.discovery.serviceId=config
-spring.cloud.config.discovery.enabled=true
-spring.cloud.config.profile=default
-spring.cloud.config.label=master

+ 0 - 22
user/src/main/java/com/wangsong/user/controller/UserController.java

@@ -1,22 +0,0 @@
-package com.wangsong.user.controller;
-
-
-import com.wangsong.user.api.UserAPI;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-
-@Controller
-@RequestMapping("/user")
-public class UserController implements UserAPI {
-
-    @RequestMapping(value = "/getUser", method = RequestMethod.POST)
-    @ResponseBody
-    public String getUser(String user) {
-        return user;
-    }
-
-
-}