├── microservicecloud-consumer-hystrix-dashboard
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ └── DeptConsumer_DashBoard_App.java
└── pom.xml
├── microservicecloud-config-client-3355
├── src
│ └── main
│ │ ├── resources
│ │ ├── application.yml
│ │ └── bootstrap.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ ├── ConfigClient_3355_StartSpringCloudApp.java
│ │ └── rest
│ │ └── ConfigClientRest.java
└── pom.xml
├── microservicecloud-config-dept-client-8001
├── src
│ └── main
│ │ ├── resources
│ │ ├── application.yml
│ │ ├── bootstrap.yml
│ │ └── mybatis
│ │ │ ├── mybatis.cfg.xml
│ │ │ └── mapper
│ │ │ └── DeptMapper.xml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ ├── service
│ │ ├── DeptService.java
│ │ └── impl
│ │ │ └── DeptServiceImpl.java
│ │ ├── dao
│ │ └── DeptDao.java
│ │ ├── DeptProvider8001_Config_App.java
│ │ └── controller
│ │ └── DeptController.java
└── pom.xml
├── microservicecloud-config-eureka-client-7001
├── src
│ └── main
│ │ ├── resources
│ │ ├── application.yml
│ │ └── bootstrap.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ └── Config_Git_EurekaServerApplication.java
└── pom.xml
├── microservicecloud-consumer-dept-80
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ ├── myrule
│ │ ├── MySelfRule.java
│ │ └── RandomRule_LW.java
│ │ └── springcloud
│ │ ├── DeptConsumer80_App.java
│ │ ├── cfgbeans
│ │ └── ConfigBean.java
│ │ └── controller
│ │ └── DeptController_Consumer.java
└── pom.xml
├── microservicecloud-config-3344
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ └── Config_3344_StartSpringCloudApp.java
└── pom.xml
├── microservicecloud-consumer-dept-feign
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ ├── DeptConsumer80_Feign_App.java
│ │ ├── cfgbeans
│ │ └── ConfigBean.java
│ │ └── controller
│ │ └── DeptController_Consumer.java
└── pom.xml
├── microservicecloud-provider-dept-8001
├── src
│ └── main
│ │ ├── resources
│ │ ├── mybatis
│ │ │ ├── mybatis.cfg.xml
│ │ │ └── mapper
│ │ │ │ └── DeptMapper.xml
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ ├── service
│ │ ├── DeptService.java
│ │ └── impl
│ │ │ └── DeptServiceImpl.java
│ │ ├── dao
│ │ └── DeptDao.java
│ │ ├── DeptProvider8001_App.java
│ │ └── controller
│ │ └── DeptController.java
└── pom.xml
├── microservicecloud-provider-dept-8002
├── src
│ └── main
│ │ ├── resources
│ │ ├── mybatis
│ │ │ ├── mybatis.cfg.xml
│ │ │ └── mapper
│ │ │ │ └── DeptMapper.xml
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ ├── service
│ │ ├── DeptService.java
│ │ └── impl
│ │ │ └── DeptServiceImpl.java
│ │ ├── dao
│ │ └── DeptDao.java
│ │ ├── DeptProvider8002_App.java
│ │ └── controller
│ │ └── DeptController.java
└── pom.xml
├── microservicecloud-provider-dept-8003
├── src
│ └── main
│ │ ├── resources
│ │ ├── mybatis
│ │ │ ├── mybatis.cfg.xml
│ │ │ └── mapper
│ │ │ │ └── DeptMapper.xml
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ ├── service
│ │ ├── DeptService.java
│ │ └── impl
│ │ │ └── DeptServiceImpl.java
│ │ ├── dao
│ │ └── DeptDao.java
│ │ ├── DeptProvider8003_App.java
│ │ └── controller
│ │ └── DeptController.java
└── pom.xml
├── microservicecloud-provider-dept-hystrix-8001
├── src
│ └── main
│ │ ├── resources
│ │ ├── mybatis
│ │ │ ├── mybatis.cfg.xml
│ │ │ └── mapper
│ │ │ │ └── DeptMapper.xml
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ ├── service
│ │ ├── DeptService.java
│ │ └── impl
│ │ │ └── DeptServiceImpl.java
│ │ ├── dao
│ │ └── DeptDao.java
│ │ ├── DeptProvider8001_Hystrix_App.java
│ │ └── controller
│ │ └── DeptController.java
└── pom.xml
├── microservicecloud-eureka-7001
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ └── EurekaServer7001_App.java
└── pom.xml
├── microservicecloud-eureka-7002
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ └── EurekaServer7002_App.java
└── pom.xml
├── microservicecloud-eureka-7003
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ └── EurekaServer7003_App.java
└── pom.xml
├── microservicecloud-api
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── atguigu
│ │ └── springcloud
│ │ ├── entities
│ │ └── Dept.java
│ │ └── service
│ │ ├── DeptClientServiceFallbackFactory.java
│ │ └── DeptClientService.java
└── pom.xml
├── microservicecloud-zuul-gateway-9527
├── src
│ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── atguigu
│ │ │ └── springcloud
│ │ │ └── Zuul_9527_StartSpringCloudApp.java
│ │ └── resources
│ │ └── application.yml
└── pom.xml
├── clouddb02.sql
├── clouddb03.sql
├── clouddb01.sql
└── pom.xml
/microservicecloud-consumer-hystrix-dashboard/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 9001
--------------------------------------------------------------------------------
/microservicecloud-config-client-3355/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: microservicecloud-config-client
--------------------------------------------------------------------------------
/microservicecloud-config-dept-client-8001/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: microservicecloud-config-dept-client
4 |
5 |
--------------------------------------------------------------------------------
/microservicecloud-config-eureka-client-7001/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: microservicecloud-config-eureka-client
4 |
5 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-80/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 80
3 |
4 |
5 | eureka:
6 | client:
7 | register-with-eureka: false
8 | service-url:
9 | defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka/,http://eureka7003.com:7003/eureka/
--------------------------------------------------------------------------------
/microservicecloud-config-eureka-client-7001/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | name: microservicecloud-config-eureka-client #需要从github上读取的资源名称,注意没有yml后缀名
5 | profile: dev
6 | label: master
7 | uri: http://config-3344.com:3344 #SpringCloudConfig获取的服务地址
8 |
9 |
--------------------------------------------------------------------------------
/microservicecloud-config-3344/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 3344
3 |
4 | spring:
5 | application:
6 | name: microservicecloud-config
7 | cloud:
8 | config:
9 | server:
10 | git:
11 | uri: https://github.com/ZeroVV/microservicecloud-config.git #GitHub上面的git仓库名字
12 |
13 |
14 |
--------------------------------------------------------------------------------
/microservicecloud-config-client-3355/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | name: microservicecloud-config-client #需要从github上读取的资源名称,注意没有yml后缀名
5 | profile: test #本次访问的配置项
6 | label: master
7 | uri: http://config-3344.com:3344 #本微服务启动后先去找3344号服务,通过SpringCloudConfig获取GitHub的服务地址
8 |
9 |
10 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-feign/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 80
3 |
4 | feign:
5 | hystrix:
6 | enabled: true
7 |
8 | eureka:
9 | client:
10 | register-with-eureka: false
11 | service-url:
12 | defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka/,http://eureka7003.com:7003/eureka/
--------------------------------------------------------------------------------
/microservicecloud-config-dept-client-8001/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | name: microservicecloud-config-dept-client #需要从github上读取的资源名称,注意没有yml后缀名
5 | #profile配置是什么就取什么配置dev or test
6 | profile: test
7 | #profile: test
8 | label: master
9 | uri: http://config-3344.com:3344 #SpringCloudConfig获取的服务地址
10 |
11 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8001/src/main/resources/mybatis/mybatis.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8002/src/main/resources/mybatis/mybatis.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8003/src/main/resources/mybatis/mybatis.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/microservicecloud-config-dept-client-8001/src/main/resources/mybatis/mybatis.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-hystrix-8001/src/main/resources/mybatis/mybatis.cfg.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8001/src/main/java/com/atguigu/springcloud/service/DeptService.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | public interface DeptService {
11 |
12 | public boolean add(Dept dept);
13 |
14 | public Dept get(Long id);
15 |
16 | public List list();
17 | }
18 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8002/src/main/java/com/atguigu/springcloud/service/DeptService.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | public interface DeptService {
11 |
12 | public boolean add(Dept dept);
13 |
14 | public Dept get(Long id);
15 |
16 | public List list();
17 | }
18 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8003/src/main/java/com/atguigu/springcloud/service/DeptService.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | public interface DeptService {
11 |
12 | public boolean add(Dept dept);
13 |
14 | public Dept get(Long id);
15 |
16 | public List list();
17 | }
18 |
--------------------------------------------------------------------------------
/microservicecloud-config-dept-client-8001/src/main/java/com/atguigu/springcloud/service/DeptService.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | public interface DeptService {
11 |
12 | public boolean add(Dept dept);
13 |
14 | public Dept get(Long id);
15 |
16 | public List list();
17 | }
18 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-hystrix-8001/src/main/java/com/atguigu/springcloud/service/DeptService.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | public interface DeptService {
11 |
12 | public boolean add(Dept dept);
13 |
14 | public Dept get(Long id);
15 |
16 | public List list();
17 | }
18 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8001/src/main/java/com/atguigu/springcloud/dao/DeptDao.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.dao;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import org.apache.ibatis.annotations.Mapper;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by ZeroV on 2018/11/6.
10 | */
11 | @Mapper
12 | public interface DeptDao {
13 |
14 | public boolean addDept(Dept dept);
15 |
16 | public Dept findById(Long id);
17 |
18 | public List findAll();
19 | }
20 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8002/src/main/java/com/atguigu/springcloud/dao/DeptDao.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.dao;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import org.apache.ibatis.annotations.Mapper;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by ZeroV on 2018/11/6.
10 | */
11 | @Mapper
12 | public interface DeptDao {
13 |
14 | public boolean addDept(Dept dept);
15 |
16 | public Dept findById(Long id);
17 |
18 | public List findAll();
19 | }
20 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8003/src/main/java/com/atguigu/springcloud/dao/DeptDao.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.dao;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import org.apache.ibatis.annotations.Mapper;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by ZeroV on 2018/11/6.
10 | */
11 | @Mapper
12 | public interface DeptDao {
13 |
14 | public boolean addDept(Dept dept);
15 |
16 | public Dept findById(Long id);
17 |
18 | public List findAll();
19 | }
20 |
--------------------------------------------------------------------------------
/microservicecloud-config-dept-client-8001/src/main/java/com/atguigu/springcloud/dao/DeptDao.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.dao;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import org.apache.ibatis.annotations.Mapper;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by ZeroV on 2018/11/6.
10 | */
11 | @Mapper
12 | public interface DeptDao {
13 |
14 | public boolean addDept(Dept dept);
15 |
16 | public Dept findById(Long id);
17 |
18 | public List findAll();
19 | }
20 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-hystrix-8001/src/main/java/com/atguigu/springcloud/dao/DeptDao.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.dao;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import org.apache.ibatis.annotations.Mapper;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by ZeroV on 2018/11/6.
10 | */
11 | @Mapper
12 | public interface DeptDao {
13 |
14 | public boolean addDept(Dept dept);
15 |
16 | public Dept findById(Long id);
17 |
18 | public List findAll();
19 | }
20 |
--------------------------------------------------------------------------------
/microservicecloud-config-client-3355/src/main/java/com/atguigu/springcloud/ConfigClient_3355_StartSpringCloudApp.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * Created by ZeroV on 2018/11/6.
8 | */
9 | @SpringBootApplication
10 | public class ConfigClient_3355_StartSpringCloudApp {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(ConfigClient_3355_StartSpringCloudApp.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-80/src/main/java/com/atguigu/myrule/MySelfRule.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.myrule;
2 |
3 | import com.netflix.loadbalancer.IRule;
4 | import com.netflix.loadbalancer.RandomRule;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * Created by ZeroV on 2018/11/6.
10 | */
11 | @Configuration
12 | public class MySelfRule {
13 |
14 | @Bean
15 | public IRule myRule() {
16 | // return new RandomRule();
17 | return new RandomRule_LW();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/microservicecloud-eureka-7001/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 7001
3 |
4 | eureka:
5 | instance:
6 | hostname: eureka7001.com #eureka服务端的实例名称
7 | client:
8 | register-with-eureka: false #false表示不向注册中心注册自己。
9 | fetch-registry: false #false表示自己端就是注册中心,我的职责就是维护服务实例,并不需要去检索服务
10 | service-url:
11 | #单机 defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ #设置与Eureka Server交互的地址查询服务和注册服务都需要依赖这个地址(单机)。
12 | defaultZone: http://eureka7002.com:7002/eureka/,http://eureka7003.com:7003/eureka/
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/microservicecloud-eureka-7002/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 7002
3 |
4 | eureka:
5 | instance:
6 | hostname: eureka7002.com #eureka服务端的实例名称
7 | client:
8 | register-with-eureka: false #false表示不向注册中心注册自己。
9 | fetch-registry: false #false表示自己端就是注册中心,我的职责就是维护服务实例,并不需要去检索服务
10 | service-url:
11 | #单机 defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ #设置与Eureka Server交互的地址查询服务和注册服务都需要依赖这个地址(单机)。
12 | defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7003.com:7003/eureka/
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/microservicecloud-eureka-7003/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 7003
3 |
4 | eureka:
5 | instance:
6 | hostname: eureka7003.com #eureka服务端的实例名称
7 | client:
8 | register-with-eureka: false #false表示不向注册中心注册自己。
9 | fetch-registry: false #false表示自己端就是注册中心,我的职责就是维护服务实例,并不需要去检索服务
10 | service-url:
11 | #单机 defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ #设置与Eureka Server交互的地址查询服务和注册服务都需要依赖这个地址(单机)。
12 | defaultZone: http://eureka7002.com:7002/eureka/,http://eureka7001.com:7001/eureka/
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/microservicecloud-eureka-7001/src/main/java/com/atguigu/springcloud/EurekaServer7001_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | @SpringBootApplication
11 | @EnableEurekaServer
12 | public class EurekaServer7001_App {
13 | public static void main(String[] args) {
14 | SpringApplication.run(EurekaServer7001_App.class,args);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/microservicecloud-eureka-7002/src/main/java/com/atguigu/springcloud/EurekaServer7002_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | @SpringBootApplication
11 | @EnableEurekaServer
12 | public class EurekaServer7002_App {
13 | public static void main(String[] args) {
14 | SpringApplication.run(EurekaServer7002_App.class,args);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/microservicecloud-eureka-7003/src/main/java/com/atguigu/springcloud/EurekaServer7003_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | @SpringBootApplication
11 | @EnableEurekaServer
12 | public class EurekaServer7003_App {
13 | public static void main(String[] args) {
14 | SpringApplication.run(EurekaServer7003_App.class,args);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/microservicecloud-api/src/main/java/com/atguigu/springcloud/entities/Dept.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.entities;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 | import lombok.experimental.Accessors;
7 |
8 | import java.io.Serializable;
9 |
10 | /**
11 | * Created by ZeroV on 2018/11/5.
12 | */
13 |
14 | @Data
15 | @AllArgsConstructor
16 | @NoArgsConstructor
17 | @Accessors(chain = true)
18 | public class Dept implements Serializable {
19 |
20 | private Long deptno;
21 | private String dname;
22 | private String db_source;
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/microservicecloud-zuul-gateway-9527/src/main/java/com/atguigu/springcloud/Zuul_9527_StartSpringCloudApp.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | @SpringBootApplication
11 | @EnableZuulProxy
12 | public class Zuul_9527_StartSpringCloudApp {
13 |
14 | public static void main(String[] args) {
15 | SpringApplication.run(Zuul_9527_StartSpringCloudApp.class, args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/microservicecloud-config-3344/src/main/java/com/atguigu/springcloud/Config_3344_StartSpringCloudApp.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.config.server.EnableConfigServer;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | @SpringBootApplication
11 | @EnableConfigServer
12 | public class Config_3344_StartSpringCloudApp {
13 |
14 | public static void main(String[] args) {
15 | SpringApplication.run(Config_3344_StartSpringCloudApp.class, args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/microservicecloud-config-eureka-client-7001/src/main/java/com/atguigu/springcloud/Config_Git_EurekaServerApplication.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | @SpringBootApplication
11 | @EnableEurekaServer
12 | public class Config_Git_EurekaServerApplication {
13 | public static void main(String[] args) {
14 | SpringApplication.run(Config_Git_EurekaServerApplication.class,args);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-hystrix-dashboard/src/main/java/com/atguigu/springcloud/DeptConsumer_DashBoard_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
6 |
7 | /**
8 | * Created by ZeroV on 2018/11/6.
9 | */
10 | @SpringBootApplication
11 | @EnableHystrixDashboard
12 | public class DeptConsumer_DashBoard_App {
13 |
14 | public static void main(String[] args) {
15 | SpringApplication.run(DeptConsumer_DashBoard_App.class, args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8001/src/main/java/com/atguigu/springcloud/DeptProvider8001_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 |
8 | /**
9 | * Created by ZeroV on 2018/11/6.
10 | */
11 |
12 | @SpringBootApplication
13 | @EnableEurekaClient
14 | @EnableDiscoveryClient
15 | public class DeptProvider8001_App {
16 | public static void main(String[] args) {
17 | SpringApplication.run(DeptProvider8001_App.class, args);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8002/src/main/java/com/atguigu/springcloud/DeptProvider8002_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 |
8 | /**
9 | * Created by ZeroV on 2018/11/6.
10 | */
11 |
12 | @SpringBootApplication
13 | @EnableEurekaClient
14 | @EnableDiscoveryClient
15 | public class DeptProvider8002_App {
16 | public static void main(String[] args) {
17 | SpringApplication.run(DeptProvider8002_App.class, args);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8003/src/main/java/com/atguigu/springcloud/DeptProvider8003_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 |
8 | /**
9 | * Created by ZeroV on 2018/11/6.
10 | */
11 |
12 | @SpringBootApplication
13 | @EnableEurekaClient
14 | @EnableDiscoveryClient
15 | public class DeptProvider8003_App {
16 | public static void main(String[] args) {
17 | SpringApplication.run(DeptProvider8003_App.class, args);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/microservicecloud-config-dept-client-8001/src/main/java/com/atguigu/springcloud/DeptProvider8001_Config_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 |
8 | @SpringBootApplication
9 | @EnableEurekaClient //本服务启动后会自动注册进eureka服务中
10 | @EnableDiscoveryClient //服务发现
11 | public class DeptProvider8001_Config_App
12 | {
13 | public static void main(String[] args)
14 | {
15 | SpringApplication.run(DeptProvider8001_Config_App.class, args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8001/src/main/resources/mybatis/mapper/DeptMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
13 |
14 | INSERT INTO dept(dname,db_source) VALUES(#{dname},DATABASE());
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8002/src/main/resources/mybatis/mapper/DeptMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
13 |
14 | INSERT INTO dept(dname,db_source) VALUES(#{dname},DATABASE());
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8003/src/main/resources/mybatis/mapper/DeptMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
13 |
14 | INSERT INTO dept(dname,db_source) VALUES(#{dname},DATABASE());
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/microservicecloud-config-dept-client-8001/src/main/resources/mybatis/mapper/DeptMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
13 |
14 | INSERT INTO dept(dname,db_source) VALUES(#{dname},DATABASE());
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-hystrix-8001/src/main/resources/mybatis/mapper/DeptMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
13 |
14 | INSERT INTO dept(dname,db_source) VALUES(#{dname},DATABASE());
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/microservicecloud-zuul-gateway-9527/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 9527
3 |
4 | spring:
5 | application:
6 | name: microservicecloud-zuul-gateway
7 |
8 | eureka:
9 | client:
10 | service-url:
11 | defaultZone: http://eureka7001.com:7001/eureka,http://eureka7002.com:7002/eureka,http://eureka7003.com:7003/eureka
12 | instance:
13 | instance-id: gateway-9527.com
14 | prefer-ip-address: true
15 |
16 |
17 | zuul:
18 | # ignored-services: microservicecloud-dept
19 | prefix: /atguigu
20 | ignored-services: "*"
21 | routes:
22 | mydept.serviceId: microservicecloud-dept
23 | mydept.path: /mydept/**
24 |
25 | info:
26 | app.name: atguigu-microcloud
27 | company.name: www.atguigu.com
28 | build.artifactId: $project.artifactId$
29 | build.version: $project.version$
30 |
31 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-80/src/main/java/com/atguigu/springcloud/DeptConsumer80_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import com.atguigu.myrule.MySelfRule;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 | import org.springframework.cloud.netflix.ribbon.RibbonClient;
8 |
9 | /**
10 | * Created by ZeroV on 2018/11/6.
11 | */
12 | @SpringBootApplication
13 | @EnableEurekaClient
14 | //在启动该微服务的时候就能去加载我们的自定义Ribbon配置类,从而使配置生效
15 | @RibbonClient(name="MICROSERVICECLOUD-DEPT",configuration=MySelfRule.class)
16 | public class DeptConsumer80_App {
17 |
18 | public static void main(String[] args) {
19 | SpringApplication.run(DeptConsumer80_App.class, args);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-80/src/main/java/com/atguigu/springcloud/cfgbeans/ConfigBean.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.cfgbeans;
2 |
3 | import com.netflix.loadbalancer.IRule;
4 | import com.netflix.loadbalancer.RetryRule;
5 | import org.springframework.cloud.client.loadbalancer.LoadBalanced;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.web.client.RestTemplate;
9 |
10 | /**
11 | * Created by ZeroV on 2018/11/6.
12 | */
13 |
14 | @Configuration
15 | public class ConfigBean {
16 |
17 | @Bean
18 | @LoadBalanced
19 | public RestTemplate getRestTemplate() {
20 | return new RestTemplate();
21 | }
22 |
23 | @Bean
24 | public IRule myRule() {
25 | //return new RandomRule();
26 | return new RetryRule();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-feign/src/main/java/com/atguigu/springcloud/DeptConsumer80_Feign_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
6 | import org.springframework.cloud.netflix.feign.EnableFeignClients;
7 | import org.springframework.context.annotation.ComponentScan;
8 |
9 | /**
10 | * Created by ZeroV on 2018/11/6.
11 | */
12 | @SpringBootApplication
13 | @EnableEurekaClient
14 | @EnableFeignClients(basePackages= {"com.atguigu.springcloud"})
15 | @ComponentScan("com.atguigu.springcloud")
16 | public class DeptConsumer80_Feign_App {
17 |
18 | public static void main(String[] args) {
19 | SpringApplication.run(DeptConsumer80_Feign_App.class, args);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-feign/src/main/java/com/atguigu/springcloud/cfgbeans/ConfigBean.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.cfgbeans;
2 |
3 | import com.netflix.loadbalancer.IRule;
4 | import com.netflix.loadbalancer.RetryRule;
5 | import org.springframework.cloud.client.loadbalancer.LoadBalanced;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.web.client.RestTemplate;
9 |
10 | /**
11 | * Created by ZeroV on 2018/11/6.
12 | */
13 |
14 | @Configuration
15 | public class ConfigBean {
16 |
17 | @Bean
18 | @LoadBalanced
19 | public RestTemplate getRestTemplate() {
20 | return new RestTemplate();
21 | }
22 |
23 | @Bean
24 | public IRule myRule() {
25 | //return new RandomRule();
26 | return new RetryRule();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-hystrix-8001/src/main/java/com/atguigu/springcloud/DeptProvider8001_Hystrix_App.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
8 |
9 | /**
10 | * Created by ZeroV on 2018/11/6.
11 | */
12 |
13 | @SpringBootApplication
14 | @EnableEurekaClient //本服务启动后会自动注册进eureka服务中
15 | @EnableDiscoveryClient //服务发现
16 | @EnableCircuitBreaker//对hystrixR熔断机制的支持
17 | public class DeptProvider8001_Hystrix_App {
18 | public static void main(String[] args) {
19 | SpringApplication.run(DeptProvider8001_Hystrix_App.class, args);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8001/src/main/java/com/atguigu/springcloud/service/impl/DeptServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service.impl;
2 |
3 | import com.atguigu.springcloud.dao.DeptDao;
4 | import com.atguigu.springcloud.entities.Dept;
5 | import com.atguigu.springcloud.service.DeptService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by ZeroV on 2018/11/6.
13 | */
14 | @Service
15 | public class DeptServiceImpl implements DeptService {
16 |
17 | @Autowired
18 | private DeptDao dao;
19 |
20 |
21 | @Override
22 | public boolean add(Dept dept) {
23 | return dao.addDept(dept);
24 | }
25 |
26 | @Override
27 | public Dept get(Long id) {
28 | return dao.findById(id);
29 | }
30 |
31 | @Override
32 | public List list() {
33 | return dao.findAll();
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8002/src/main/java/com/atguigu/springcloud/service/impl/DeptServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service.impl;
2 |
3 | import com.atguigu.springcloud.dao.DeptDao;
4 | import com.atguigu.springcloud.entities.Dept;
5 | import com.atguigu.springcloud.service.DeptService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by ZeroV on 2018/11/6.
13 | */
14 | @Service
15 | public class DeptServiceImpl implements DeptService {
16 |
17 | @Autowired
18 | private DeptDao dao;
19 |
20 |
21 | @Override
22 | public boolean add(Dept dept) {
23 | return dao.addDept(dept);
24 | }
25 |
26 | @Override
27 | public Dept get(Long id) {
28 | return dao.findById(id);
29 | }
30 |
31 | @Override
32 | public List list() {
33 | return dao.findAll();
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8003/src/main/java/com/atguigu/springcloud/service/impl/DeptServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service.impl;
2 |
3 | import com.atguigu.springcloud.dao.DeptDao;
4 | import com.atguigu.springcloud.entities.Dept;
5 | import com.atguigu.springcloud.service.DeptService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by ZeroV on 2018/11/6.
13 | */
14 | @Service
15 | public class DeptServiceImpl implements DeptService {
16 |
17 | @Autowired
18 | private DeptDao dao;
19 |
20 |
21 | @Override
22 | public boolean add(Dept dept) {
23 | return dao.addDept(dept);
24 | }
25 |
26 | @Override
27 | public Dept get(Long id) {
28 | return dao.findById(id);
29 | }
30 |
31 | @Override
32 | public List list() {
33 | return dao.findAll();
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/microservicecloud-config-dept-client-8001/src/main/java/com/atguigu/springcloud/service/impl/DeptServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service.impl;
2 |
3 | import com.atguigu.springcloud.dao.DeptDao;
4 | import com.atguigu.springcloud.entities.Dept;
5 | import com.atguigu.springcloud.service.DeptService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by ZeroV on 2018/11/6.
13 | */
14 | @Service
15 | public class DeptServiceImpl implements DeptService {
16 |
17 | @Autowired
18 | private DeptDao dao;
19 |
20 |
21 | @Override
22 | public boolean add(Dept dept) {
23 | return dao.addDept(dept);
24 | }
25 |
26 | @Override
27 | public Dept get(Long id) {
28 | return dao.findById(id);
29 | }
30 |
31 | @Override
32 | public List list() {
33 | return dao.findAll();
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-hystrix-8001/src/main/java/com/atguigu/springcloud/service/impl/DeptServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service.impl;
2 |
3 | import com.atguigu.springcloud.dao.DeptDao;
4 | import com.atguigu.springcloud.entities.Dept;
5 | import com.atguigu.springcloud.service.DeptService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by ZeroV on 2018/11/6.
13 | */
14 | @Service
15 | public class DeptServiceImpl implements DeptService {
16 |
17 | @Autowired
18 | private DeptDao dao;
19 |
20 |
21 | @Override
22 | public boolean add(Dept dept) {
23 | return dao.addDept(dept);
24 | }
25 |
26 | @Override
27 | public Dept get(Long id) {
28 | return dao.findById(id);
29 | }
30 |
31 | @Override
32 | public List list() {
33 | return dao.findAll();
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/microservicecloud-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | microservicecloud
9 | com.atguigu.springcloud
10 | 1.0-SNAPSHOT
11 |
12 |
13 | microservicecloud-api
14 |
15 |
16 |
17 | org.projectlombok
18 | lombok
19 |
20 |
21 | org.springframework.cloud
22 | spring-cloud-starter-feign
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/microservicecloud-config-client-3355/src/main/java/com/atguigu/springcloud/rest/ConfigClientRest.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.rest;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | @RestController
8 | public class ConfigClientRest
9 | {
10 |
11 | @Value("${spring.application.name}")
12 | private String applicationName;
13 |
14 | @Value("${eureka.client.service-url.defaultZone}")
15 | private String eurekaServers;
16 |
17 | @Value("${server.port}")
18 | private String port;
19 |
20 | @RequestMapping("/config")
21 | public String getConfig()
22 | {
23 | String str = "applicationName: " + applicationName + "\t eurekaServers:" + eurekaServers + "\t port: " + port;
24 | System.out.println("******str: " + str);
25 | return "applicationName: " + applicationName + "\t eurekaServers:" + eurekaServers + "\t port: " + port;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/clouddb02.sql:
--------------------------------------------------------------------------------
1 | /*
2 | Navicat MySQL Data Transfer
3 |
4 | Source Server : mysql
5 | Source Server Version : 50527
6 | Source Host : localhost:3306
7 | Source Database : clouddb02
8 |
9 | Target Server Type : MYSQL
10 | Target Server Version : 50527
11 | File Encoding : 65001
12 |
13 | Date: 2019-01-27 02:17:16
14 | */
15 |
16 | SET FOREIGN_KEY_CHECKS=0;
17 |
18 | -- ----------------------------
19 | -- Table structure for dept
20 | -- ----------------------------
21 | DROP TABLE IF EXISTS `dept`;
22 | CREATE TABLE `dept` (
23 | `deptno` bigint(20) NOT NULL AUTO_INCREMENT,
24 | `dname` varchar(60) DEFAULT NULL,
25 | `db_source` varchar(60) DEFAULT NULL,
26 | PRIMARY KEY (`deptno`)
27 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
28 |
29 | -- ----------------------------
30 | -- Records of dept
31 | -- ----------------------------
32 | INSERT INTO `dept` VALUES ('1', '人事部', 'clouddb02');
33 | INSERT INTO `dept` VALUES ('2', '财务部', 'clouddb02');
34 | INSERT INTO `dept` VALUES ('3', '市场部', 'clouddb02');
35 | INSERT INTO `dept` VALUES ('4', '运维部', 'clouddb02');
36 |
--------------------------------------------------------------------------------
/clouddb03.sql:
--------------------------------------------------------------------------------
1 | /*
2 | Navicat MySQL Data Transfer
3 |
4 | Source Server : mysql
5 | Source Server Version : 50527
6 | Source Host : localhost:3306
7 | Source Database : clouddb03
8 |
9 | Target Server Type : MYSQL
10 | Target Server Version : 50527
11 | File Encoding : 65001
12 |
13 | Date: 2019-01-27 02:17:22
14 | */
15 |
16 | SET FOREIGN_KEY_CHECKS=0;
17 |
18 | -- ----------------------------
19 | -- Table structure for dept
20 | -- ----------------------------
21 | DROP TABLE IF EXISTS `dept`;
22 | CREATE TABLE `dept` (
23 | `deptno` bigint(20) NOT NULL AUTO_INCREMENT,
24 | `dname` varchar(60) DEFAULT NULL,
25 | `db_source` varchar(60) DEFAULT NULL,
26 | PRIMARY KEY (`deptno`)
27 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
28 |
29 | -- ----------------------------
30 | -- Records of dept
31 | -- ----------------------------
32 | INSERT INTO `dept` VALUES ('1', '人事部', 'clouddb03');
33 | INSERT INTO `dept` VALUES ('2', '财务部', 'clouddb03');
34 | INSERT INTO `dept` VALUES ('3', '市场部', 'clouddb03');
35 | INSERT INTO `dept` VALUES ('4', '运维部', 'clouddb03');
36 |
--------------------------------------------------------------------------------
/clouddb01.sql:
--------------------------------------------------------------------------------
1 | /*
2 | Navicat MySQL Data Transfer
3 |
4 | Source Server : mysql
5 | Source Server Version : 50527
6 | Source Host : localhost:3306
7 | Source Database : clouddb01
8 |
9 | Target Server Type : MYSQL
10 | Target Server Version : 50527
11 | File Encoding : 65001
12 |
13 | Date: 2019-01-27 02:17:07
14 | */
15 |
16 | SET FOREIGN_KEY_CHECKS=0;
17 |
18 | -- ----------------------------
19 | -- Table structure for dept
20 | -- ----------------------------
21 | DROP TABLE IF EXISTS `dept`;
22 | CREATE TABLE `dept` (
23 | `deptno` bigint(20) NOT NULL AUTO_INCREMENT,
24 | `dname` varchar(60) DEFAULT NULL,
25 | `db_source` varchar(60) DEFAULT NULL,
26 | PRIMARY KEY (`deptno`)
27 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
28 |
29 | -- ----------------------------
30 | -- Records of dept
31 | -- ----------------------------
32 | INSERT INTO `dept` VALUES ('1', '人事部', 'clouddb01');
33 | INSERT INTO `dept` VALUES ('2', '财务部', 'clouddb01');
34 | INSERT INTO `dept` VALUES ('3', '市场部', 'clouddb01');
35 | INSERT INTO `dept` VALUES ('4', '运维部', 'clouddb01');
36 | INSERT INTO `dept` VALUES ('5', '渠道部', 'clouddb01');
37 |
--------------------------------------------------------------------------------
/microservicecloud-api/src/main/java/com/atguigu/springcloud/service/DeptClientServiceFallbackFactory.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import feign.hystrix.FallbackFactory;
5 | import org.springframework.stereotype.Component;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by ZeroV on 2018/11/7.
11 | */
12 | @Component
13 | public class DeptClientServiceFallbackFactory implements FallbackFactory {
14 |
15 | @Override
16 | public DeptClientService create(Throwable throwable) {
17 | return new DeptClientService() {
18 | @Override
19 | public Dept get(long id) {
20 | return new Dept().setDeptno(id).setDname("该ID:" + id + "没有没有对应的信息,Consumer客户端提供的降级信息,此刻服务Provider已经关闭")
21 | .setDb_source("no this database in MySQL");
22 | }
23 |
24 | @Override
25 | public List list() {
26 | return null;
27 | }
28 |
29 | @Override
30 | public boolean add(Dept dept) {
31 | return false;
32 | }
33 | };
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-feign/src/main/java/com/atguigu/springcloud/controller/DeptController_Consumer.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.controller;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import com.atguigu.springcloud.service.DeptClientService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.PathVariable;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * Created by ZeroV on 2018/11/6.
14 | */
15 | @RestController
16 | public class DeptController_Consumer {
17 |
18 | @Autowired
19 | DeptClientService service;
20 |
21 | @RequestMapping(value = "/consumer/dept/get/{id}")
22 | public Dept get(@PathVariable("id") Long id)
23 | {
24 | return this.service.get(id);
25 | }
26 |
27 | @RequestMapping(value = "/consumer/dept/list")
28 | public List list()
29 | {
30 | return this.service.list();
31 | }
32 |
33 | @RequestMapping(value = "/consumer/dept/add")
34 | public Object add(Dept dept)
35 | {
36 | return this.service.add(dept);
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/microservicecloud-eureka-7001/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-eureka-7001
13 |
14 |
15 |
16 |
17 | org.springframework.cloud
18 | spring-cloud-starter-eureka-server
19 |
20 |
21 |
22 | org.springframework
23 | springloaded
24 |
25 |
26 | org.springframework.boot
27 | spring-boot-devtools
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/microservicecloud-eureka-7002/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-eureka-7002
13 |
14 |
15 |
16 |
17 | org.springframework.cloud
18 | spring-cloud-starter-eureka-server
19 |
20 |
21 |
22 | org.springframework
23 | springloaded
24 |
25 |
26 | org.springframework.boot
27 | spring-boot-devtools
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/microservicecloud-eureka-7003/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-eureka-7003
13 |
14 |
15 |
16 |
17 | org.springframework.cloud
18 | spring-cloud-starter-eureka-server
19 |
20 |
21 |
22 | org.springframework
23 | springloaded
24 |
25 |
26 | org.springframework.boot
27 | spring-boot-devtools
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/microservicecloud-api/src/main/java/com/atguigu/springcloud/service/DeptClientService.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.service;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import org.springframework.cloud.netflix.feign.FeignClient;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RequestMethod;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | *
13 | * @Description: 修改microservicecloud-api工程,根据已经有的DeptClientService接口
14 |
15 | 新建
16 |
17 | 一个实现了FallbackFactory接口的类DeptClientServiceFallbackFactory
18 | * @author zzyy
19 | * @date 2018年4月21日
20 | */
21 | //@FeignClient(value = "MICROSERVICECLOUD-DEPT")
22 | @FeignClient(value = "MICROSERVICECLOUD-DEPT",fallbackFactory=DeptClientServiceFallbackFactory.class)
23 | public interface DeptClientService
24 | {
25 | @RequestMapping(value = "/dept/get/{id}", method = RequestMethod.GET)
26 | public Dept get(@PathVariable("id") long id);
27 |
28 | @RequestMapping(value = "/dept/list", method = RequestMethod.GET)
29 | public List list();
30 |
31 | @RequestMapping(value = "/dept/add", method = RequestMethod.POST)
32 | public boolean add(Dept dept);
33 | }
34 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-hystrix-8001/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8001
3 |
4 | mybatis:
5 | config-location: classpath:mybatis/mybatis.cfg.xml #mybatis所在路径
6 | type-aliases-package: com.atguigu.springcloud.entities #entity别名类
7 | mapper-locations:
8 | - classpath:mybatis/mapper/**/*.xml #mapper映射文件
9 |
10 | spring:
11 | application:
12 | name: microservicecloud-dept
13 | datasource:
14 | type: com.alibaba.druid.pool.DruidDataSource
15 | driver-class-name: org.gjt.mm.mysql.Driver
16 | url: jdbc:mysql://localhost:3306/cloudDB01
17 | username: root
18 | password: 123456
19 | dbcp2:
20 | min-idle: 5
21 | initial-size: 5
22 | max-total: 5
23 | max-wait-millis: 200
24 |
25 | eureka:
26 | client: #客户端注册进eureka服务列表内
27 | service-url:
28 | defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka/,http://eureka7003.com:7003/eureka/
29 | instance:
30 | instance-id: microservicecloud-dept8001-hystrix #自定义hystrix相关的服务名称信息
31 | prefer-ip-address: true #访问路径可以显示IP地址
32 |
33 | info:
34 | app.name: atguigu-microservicecloud
35 | company.name: www.atguigu.com
36 | build.artifactId: $project.artifactId$
37 | build.version: $project.version$
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/microservicecloud-config-eureka-client-7001/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-config-eureka-client-7001
13 |
14 |
15 |
16 |
17 | org.springframework.cloud
18 | spring-cloud-starter-config
19 |
20 |
21 | org.springframework.cloud
22 | spring-cloud-starter-eureka-server
23 |
24 |
25 |
26 | org.springframework
27 | springloaded
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-devtools
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-hystrix-8001/src/main/java/com/atguigu/springcloud/controller/DeptController.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.controller;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.web.bind.annotation.PathVariable;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.RequestMethod;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | import com.atguigu.springcloud.entities.Dept;
10 | import com.atguigu.springcloud.service.DeptService;
11 | import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
12 |
13 | @RestController
14 | public class DeptController
15 | {
16 | @Autowired
17 | private DeptService service = null;
18 |
19 | @RequestMapping(value = "/dept/get/{id}", method = RequestMethod.GET)
20 | //一旦调用服务方法失败并抛出了错误信息后,会自动调用@HystrixCommand标注好的fallbackMethod调用类中的指定方法
21 | @HystrixCommand(fallbackMethod = "processHystrix_Get")
22 | public Dept get(@PathVariable("id") Long id)
23 | {
24 |
25 | Dept dept = this.service.get(id);
26 |
27 | if (null == dept) {
28 | throw new RuntimeException("该ID:" + id + "没有没有对应的信息");
29 | }
30 |
31 | return dept;
32 | }
33 |
34 | public Dept processHystrix_Get(@PathVariable("id") Long id)
35 | {
36 | return new Dept().setDeptno(id).setDname("该ID:" + id + "没有没有对应的信息,null--@HystrixCommand")
37 | .setDb_source("no this database in MySQL");
38 | }
39 | }
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8001/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8001
3 |
4 | mybatis:
5 | config-location: classpath:mybatis/mybatis.cfg.xml # mybatis配置文件所在路径
6 | type-aliases-package: com.atguigu.springcloud.entities # 所有Entity别名类所在包
7 | mapper-locations:
8 | - classpath:mybatis/mapper/**/*.xml # mapper映射文件
9 |
10 | spring:
11 | application:
12 | name: microservicecloud-dept
13 | datasource:
14 | type: com.alibaba.druid.pool.DruidDataSource # 当前数据源操作类型
15 | driver-class-name: org.gjt.mm.mysql.Driver # mysql驱动包
16 | url: jdbc:mysql://localhost:3306/cloudDB01 # 数据库名称
17 | username: root
18 | password: 123456
19 | dbcp2:
20 | min-idle: 5 # 数据库连接池的最小维持连接数
21 | initial-size: 5 # 初始化连接数
22 | max-total: 5 # 最大连接数
23 | max-wait-millis: 200 # 等待连接获取的最大超时时间
24 |
25 | eureka:
26 | client: #客户端注册进eureka服务列表内
27 | service-url:
28 | #defaultZone: http://localhost:7001/eureka
29 | defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka/,http://eureka7003.com:7003/eureka/
30 | instance:
31 | instance-id: microservicecloud-dept8001
32 | prefer-ip-address: true #访问路径可以显示IP地址
33 |
34 | info:
35 | app.name: atguigu-microservicecloud
36 | company.name: www.atguigu.com
37 | build.artifactId: $project.artifactId$
38 | build.version: $project.version$
39 |
40 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8002/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8002
3 |
4 | mybatis:
5 | config-location: classpath:mybatis/mybatis.cfg.xml # mybatis配置文件所在路径
6 | type-aliases-package: com.atguigu.springcloud.entities # 所有Entity别名类所在包
7 | mapper-locations:
8 | - classpath:mybatis/mapper/**/*.xml # mapper映射文件
9 |
10 | spring:
11 | application:
12 | name: microservicecloud-dept
13 | datasource:
14 | type: com.alibaba.druid.pool.DruidDataSource # 当前数据源操作类型
15 | driver-class-name: org.gjt.mm.mysql.Driver # mysql驱动包
16 | url: jdbc:mysql://localhost:3306/cloudDB02 # 数据库名称
17 | username: root
18 | password: 123456
19 | dbcp2:
20 | min-idle: 5 # 数据库连接池的最小维持连接数
21 | initial-size: 5 # 初始化连接数
22 | max-total: 5 # 最大连接数
23 | max-wait-millis: 200 # 等待连接获取的最大超时时间
24 |
25 | eureka:
26 | client: #客户端注册进eureka服务列表内
27 | service-url:
28 | #defaultZone: http://localhost:7001/eureka
29 | defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka/,http://eureka7003.com:7003/eureka/
30 | instance:
31 | instance-id: microservicecloud-dept8002
32 | prefer-ip-address: true #访问路径可以显示IP地址
33 |
34 | info:
35 | app.name: atguigu-microservicecloud
36 | company.name: www.atguigu.com
37 | build.artifactId: $project.artifactId$
38 | build.version: $project.version$
39 |
40 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8003/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8003
3 |
4 | mybatis:
5 | config-location: classpath:mybatis/mybatis.cfg.xml # mybatis配置文件所在路径
6 | type-aliases-package: com.atguigu.springcloud.entities # 所有Entity别名类所在包
7 | mapper-locations:
8 | - classpath:mybatis/mapper/**/*.xml # mapper映射文件
9 |
10 | spring:
11 | application:
12 | name: microservicecloud-dept
13 | datasource:
14 | type: com.alibaba.druid.pool.DruidDataSource # 当前数据源操作类型
15 | driver-class-name: org.gjt.mm.mysql.Driver # mysql驱动包
16 | url: jdbc:mysql://localhost:3306/cloudDB03 # 数据库名称
17 | username: root
18 | password: 123456
19 | dbcp2:
20 | min-idle: 5 # 数据库连接池的最小维持连接数
21 | initial-size: 5 # 初始化连接数
22 | max-total: 5 # 最大连接数
23 | max-wait-millis: 200 # 等待连接获取的最大超时时间
24 |
25 | eureka:
26 | client: #客户端注册进eureka服务列表内
27 | service-url:
28 | #defaultZone: http://localhost:7001/eureka
29 | defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka/,http://eureka7003.com:7003/eureka/
30 | instance:
31 | instance-id: microservicecloud-dept8003
32 | prefer-ip-address: true #访问路径可以显示IP地址
33 |
34 | info:
35 | app.name: atguigu-microservicecloud
36 | company.name: www.atguigu.com
37 | build.artifactId: $project.artifactId$
38 | build.version: $project.version$
39 |
40 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-80/src/main/java/com/atguigu/springcloud/controller/DeptController_Consumer.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.controller;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RestController;
8 | import org.springframework.web.client.RestTemplate;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * Created by ZeroV on 2018/11/6.
14 | */
15 | @RestController
16 | public class DeptController_Consumer {
17 |
18 | //private static final String REST_URL_PREFIX = "http://localhost:8001";
19 | private static final String REST_URL_PREFIX = "http://MICROSERVICECLOUD-DEPT";
20 |
21 | @Autowired
22 | private RestTemplate restTemplate;
23 |
24 |
25 | @RequestMapping(value = "/consumer/dept/add")
26 | public boolean add(Dept dept) {
27 | return restTemplate.postForObject(REST_URL_PREFIX + "/dept/add", dept, Boolean.class);
28 | }
29 |
30 | @RequestMapping(value = "/consumer/dept/get/{id}")
31 | public Dept get(@PathVariable("id") Long id) {
32 | return restTemplate.getForObject(REST_URL_PREFIX + "/dept/get/" + id, Dept.class);
33 | }
34 |
35 | @SuppressWarnings("unchecked")
36 | @RequestMapping(value = "/consumer/dept/list")
37 | public List list() {
38 | return restTemplate.getForObject(REST_URL_PREFIX + "/dept/list", List.class);
39 | }
40 |
41 | // 测试@EnableDiscoveryClient,消费端可以调用服务发现
42 | @RequestMapping(value = "/consumer/dept/discovery")
43 | public Object discovery() {
44 | return restTemplate.getForObject(REST_URL_PREFIX + "/dept/discovery", Object.class);
45 | }
46 |
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8001/src/main/java/com/atguigu/springcloud/controller/DeptController.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.controller;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import com.atguigu.springcloud.service.DeptService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.cloud.client.ServiceInstance;
7 | import org.springframework.cloud.client.discovery.DiscoveryClient;
8 | import org.springframework.web.bind.annotation.*;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * Created by ZeroV on 2018/11/6.
14 | */
15 | @RestController
16 | public class DeptController {
17 |
18 | @Autowired
19 | private DeptService service;
20 |
21 | @Autowired
22 | private DiscoveryClient client;
23 |
24 | @RequestMapping(value = "/dept/add", method = RequestMethod.POST)
25 | public boolean add(@RequestBody Dept dept) {
26 | return service.add(dept);
27 | }
28 |
29 | @RequestMapping(value = "/dept/get/{id}", method = RequestMethod.GET)
30 | public Dept get(@PathVariable("id") Long id) {
31 | return service.get(id);
32 | }
33 |
34 | @RequestMapping(value = "/dept/list", method = RequestMethod.GET)
35 | public List list() {
36 | return service.list();
37 | }
38 |
39 | @RequestMapping(value = "/dept/discovery", method = RequestMethod.GET)
40 | public Object discovery() {
41 | List list = client.getServices();
42 | System.out.println("**********" + list);
43 |
44 | List srvList = client.getInstances("MICROSERVICECLOUD-DEPT");
45 | for (ServiceInstance element : srvList) {
46 | System.out.println(element.getServiceId() + "\t" + element.getHost() + "\t" + element.getPort() + "\t"
47 | + element.getUri());
48 | }
49 | return this.client;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8002/src/main/java/com/atguigu/springcloud/controller/DeptController.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.controller;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import com.atguigu.springcloud.service.DeptService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.cloud.client.ServiceInstance;
7 | import org.springframework.cloud.client.discovery.DiscoveryClient;
8 | import org.springframework.web.bind.annotation.*;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * Created by ZeroV on 2018/11/6.
14 | */
15 | @RestController
16 | public class DeptController {
17 |
18 | @Autowired
19 | private DeptService service;
20 |
21 | @Autowired
22 | private DiscoveryClient client;
23 |
24 | @RequestMapping(value = "/dept/add", method = RequestMethod.POST)
25 | public boolean add(@RequestBody Dept dept) {
26 | return service.add(dept);
27 | }
28 |
29 | @RequestMapping(value = "/dept/get/{id}", method = RequestMethod.GET)
30 | public Dept get(@PathVariable("id") Long id) {
31 | return service.get(id);
32 | }
33 |
34 | @RequestMapping(value = "/dept/list", method = RequestMethod.GET)
35 | public List list() {
36 | return service.list();
37 | }
38 |
39 | @RequestMapping(value = "/dept/discovery", method = RequestMethod.GET)
40 | public Object discovery() {
41 | List list = client.getServices();
42 | System.out.println("**********" + list);
43 |
44 | List srvList = client.getInstances("MICROSERVICECLOUD-DEPT");
45 | for (ServiceInstance element : srvList) {
46 | System.out.println(element.getServiceId() + "\t" + element.getHost() + "\t" + element.getPort() + "\t"
47 | + element.getUri());
48 | }
49 | return this.client;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8003/src/main/java/com/atguigu/springcloud/controller/DeptController.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.controller;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import com.atguigu.springcloud.service.DeptService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.cloud.client.ServiceInstance;
7 | import org.springframework.cloud.client.discovery.DiscoveryClient;
8 | import org.springframework.web.bind.annotation.*;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * Created by ZeroV on 2018/11/6.
14 | */
15 | @RestController
16 | public class DeptController {
17 |
18 | @Autowired
19 | private DeptService service;
20 |
21 | @Autowired
22 | private DiscoveryClient client;
23 |
24 | @RequestMapping(value = "/dept/add", method = RequestMethod.POST)
25 | public boolean add(@RequestBody Dept dept) {
26 | return service.add(dept);
27 | }
28 |
29 | @RequestMapping(value = "/dept/get/{id}", method = RequestMethod.GET)
30 | public Dept get(@PathVariable("id") Long id) {
31 | return service.get(id);
32 | }
33 |
34 | @RequestMapping(value = "/dept/list", method = RequestMethod.GET)
35 | public List list() {
36 | return service.list();
37 | }
38 |
39 | @RequestMapping(value = "/dept/discovery", method = RequestMethod.GET)
40 | public Object discovery() {
41 | List list = client.getServices();
42 | System.out.println("**********" + list);
43 |
44 | List srvList = client.getInstances("MICROSERVICECLOUD-DEPT");
45 | for (ServiceInstance element : srvList) {
46 | System.out.println(element.getServiceId() + "\t" + element.getHost() + "\t" + element.getPort() + "\t"
47 | + element.getUri());
48 | }
49 | return this.client;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/microservicecloud-config-dept-client-8001/src/main/java/com/atguigu/springcloud/controller/DeptController.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.springcloud.controller;
2 |
3 | import com.atguigu.springcloud.entities.Dept;
4 | import com.atguigu.springcloud.service.DeptService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.cloud.client.ServiceInstance;
7 | import org.springframework.cloud.client.discovery.DiscoveryClient;
8 | import org.springframework.web.bind.annotation.*;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * Created by ZeroV on 2018/11/6.
14 | */
15 | @RestController
16 | public class DeptController {
17 |
18 | @Autowired
19 | private DeptService service;
20 |
21 | @Autowired
22 | private DiscoveryClient client;
23 |
24 | @RequestMapping(value = "/dept/add", method = RequestMethod.POST)
25 | public boolean add(@RequestBody Dept dept) {
26 | return service.add(dept);
27 | }
28 |
29 | @RequestMapping(value = "/dept/get/{id}", method = RequestMethod.GET)
30 | public Dept get(@PathVariable("id") Long id) {
31 | return service.get(id);
32 | }
33 |
34 | @RequestMapping(value = "/dept/list", method = RequestMethod.GET)
35 | public List list() {
36 | return service.list();
37 | }
38 |
39 | @RequestMapping(value = "/dept/discovery", method = RequestMethod.GET)
40 | public Object discovery() {
41 | List list = client.getServices();
42 | System.out.println("**********" + list);
43 |
44 | List srvList = client.getInstances("MICROSERVICECLOUD-DEPT");
45 | for (ServiceInstance element : srvList) {
46 | System.out.println(element.getServiceId() + "\t" + element.getHost() + "\t" + element.getPort() + "\t"
47 | + element.getUri());
48 | }
49 | return this.client;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-80/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-consumer-dept-80
13 |
14 |
15 |
16 |
17 | com.atguigu.springcloud
18 | microservicecloud-api
19 | ${project.version}
20 |
21 |
22 | org.springframework.boot
23 | spring-boot-starter-web
24 |
25 |
26 |
27 | org.springframework.cloud
28 | spring-cloud-starter-eureka
29 |
30 |
31 | org.springframework.cloud
32 | spring-cloud-starter-ribbon
33 |
34 |
35 | org.springframework.cloud
36 | spring-cloud-starter-config
37 |
38 |
39 |
40 | org.springframework
41 | springloaded
42 |
43 |
44 | org.springframework.boot
45 | spring-boot-devtools
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/microservicecloud-config-client-3355/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-config-client-3355
13 |
14 |
15 |
16 |
17 |
18 | org.springframework.cloud
19 | spring-cloud-starter-config
20 |
21 |
22 | org.springframework.boot
23 | spring-boot-starter-actuator
24 |
25 |
26 | org.springframework.cloud
27 | spring-cloud-starter-hystrix
28 |
29 |
30 | org.springframework.cloud
31 | spring-cloud-starter-eureka
32 |
33 |
34 | org.springframework.cloud
35 | spring-cloud-starter-config
36 |
37 |
38 | org.springframework.boot
39 | spring-boot-starter-jetty
40 |
41 |
42 | org.springframework.boot
43 | spring-boot-starter-web
44 |
45 |
46 | org.springframework.boot
47 | spring-boot-starter-test
48 |
49 |
50 | org.springframework
51 | springloaded
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-devtools
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-feign/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-consumer-dept-feign
13 |
14 |
15 |
16 |
17 | com.atguigu.springcloud
18 | microservicecloud-api
19 | ${project.version}
20 |
21 |
22 | org.springframework.cloud
23 | spring-cloud-starter-feign
24 |
25 |
26 | org.springframework.boot
27 | spring-boot-starter-web
28 |
29 |
30 |
31 | org.springframework.cloud
32 | spring-cloud-starter-eureka
33 |
34 |
35 | org.springframework.cloud
36 | spring-cloud-starter-ribbon
37 |
38 |
39 | org.springframework.cloud
40 | spring-cloud-starter-config
41 |
42 |
43 |
44 | org.springframework
45 | springloaded
46 |
47 |
48 | org.springframework.boot
49 | spring-boot-devtools
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/microservicecloud-config-3344/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-config-3344
13 |
14 |
15 |
16 |
17 |
18 | org.springframework.cloud
19 | spring-cloud-config-server
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-actuator
25 |
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-hystrix
30 |
31 |
32 | org.springframework.cloud
33 | spring-cloud-starter-eureka
34 |
35 |
36 | org.springframework.cloud
37 | spring-cloud-starter-config
38 |
39 |
40 | org.springframework.boot
41 | spring-boot-starter-jetty
42 |
43 |
44 | org.springframework.boot
45 | spring-boot-starter-web
46 |
47 |
48 | org.springframework.boot
49 | spring-boot-starter-test
50 |
51 |
52 |
53 | org.springframework
54 | springloaded
55 |
56 |
57 | org.springframework.boot
58 | spring-boot-devtools
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-hystrix-dashboard/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-consumer-hystrix-dashboard
13 |
14 |
15 |
16 |
17 |
18 | com.atguigu.springcloud
19 | microservicecloud-api
20 | ${project.version}
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 |
28 | org.springframework
29 | springloaded
30 |
31 |
32 | org.springframework.boot
33 | spring-boot-devtools
34 |
35 |
36 |
37 | org.springframework.cloud
38 | spring-cloud-starter-eureka
39 |
40 |
41 | org.springframework.cloud
42 | spring-cloud-starter-ribbon
43 |
44 |
45 | org.springframework.cloud
46 | spring-cloud-starter-config
47 |
48 |
49 |
50 | org.springframework.cloud
51 | spring-cloud-starter-feign
52 |
53 |
54 |
55 | org.springframework.cloud
56 | spring-cloud-starter-hystrix
57 |
58 |
59 | org.springframework.cloud
60 | spring-cloud-starter-hystrix-dashboard
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/microservicecloud-zuul-gateway-9527/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-zuul-gateway-9527
13 |
14 |
15 |
16 |
17 |
18 | org.springframework.cloud
19 | spring-cloud-starter-zuul
20 |
21 |
22 | org.springframework.cloud
23 | spring-cloud-starter-eureka
24 |
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-actuator
29 |
30 |
31 |
32 | org.springframework.cloud
33 | spring-cloud-starter-hystrix
34 |
35 |
36 | org.springframework.cloud
37 | spring-cloud-starter-config
38 |
39 |
40 |
41 | com.atguigu.springcloud
42 | microservicecloud-api
43 | ${project.version}
44 |
45 |
46 | org.springframework.boot
47 | spring-boot-starter-jetty
48 |
49 |
50 | org.springframework.boot
51 | spring-boot-starter-web
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-starter-test
56 |
57 |
58 |
59 | org.springframework
60 | springloaded
61 |
62 |
63 | org.springframework.boot
64 | spring-boot-devtools
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/microservicecloud-config-dept-client-8001/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 |
7 | com.atguigu.springcloud
8 | microservicecloud
9 | 1.0-SNAPSHOT
10 |
11 |
12 | microservicecloud-config-dept-client-8001
13 |
14 |
15 |
16 |
17 | org.springframework.cloud
18 | spring-cloud-starter-config
19 |
20 |
21 | org.springframework.boot
22 | spring-boot-starter-actuator
23 |
24 |
25 | org.springframework.cloud
26 | spring-cloud-starter-eureka
27 |
28 |
29 | com.atguigu.springcloud
30 | microservicecloud-api
31 | ${project.version}
32 |
33 |
34 | junit
35 | junit
36 |
37 |
38 | mysql
39 | mysql-connector-java
40 |
41 |
42 | com.alibaba
43 | druid
44 |
45 |
46 | ch.qos.logback
47 | logback-core
48 |
49 |
50 | org.mybatis.spring.boot
51 | mybatis-spring-boot-starter
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-starter-jetty
56 |
57 |
58 | org.springframework.boot
59 | spring-boot-starter-web
60 |
61 |
62 | org.springframework.boot
63 | spring-boot-starter-test
64 |
65 |
66 | org.springframework
67 | springloaded
68 |
69 |
70 | org.springframework.boot
71 | spring-boot-devtools
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/microservicecloud-consumer-dept-80/src/main/java/com/atguigu/myrule/RandomRule_LW.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.myrule;
2 |
3 | import com.netflix.client.config.IClientConfig;
4 | import com.netflix.loadbalancer.AbstractLoadBalancerRule;
5 | import com.netflix.loadbalancer.ILoadBalancer;
6 | import com.netflix.loadbalancer.Server;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by ZeroV on 2018/11/6.
12 | */
13 | public class RandomRule_LW extends AbstractLoadBalancerRule {
14 |
15 | // total = 0 // 当total==5以后,我们指针才能往下走,
16 | // index = 0 // 当前对外提供服务的服务器地址,
17 | // total需要重新置为零,但是已经达到过一个5次,我们的index = 1
18 | // 分析:我们5次,但是微服务只有8001 8002 8003 三台,OK?
19 | //
20 |
21 |
22 | private int total = 0; // 总共被调用的次数,目前要求每台被调用5次
23 | private int currentIndex = 0; // 当前提供服务的机器号
24 |
25 | public Server choose(ILoadBalancer lb, Object key) {
26 | if (lb == null) {
27 | return null;
28 | }
29 | Server server = null;
30 |
31 | while (server == null) {
32 | if (Thread.interrupted()) {
33 | return null;
34 | }
35 | List upList = lb.getReachableServers();
36 | List allList = lb.getAllServers();
37 |
38 | int serverCount = allList.size();
39 | if (serverCount == 0) {
40 | /*
41 | * No servers. End regardless of pass, because subsequent passes only get more
42 | * restrictive.
43 | */
44 | return null;
45 | }
46 |
47 | // int index = rand.nextInt(serverCount);// java.util.Random().nextInt(3);
48 | // server = upList.get(index);
49 |
50 |
51 | // private int total = 0; // 总共被调用的次数,目前要求每台被调用5次
52 | // private int currentIndex = 0; // 当前提供服务的机器号
53 | if (total < 5) {
54 | server = upList.get(currentIndex);
55 | total++;
56 | } else {
57 | total = 0;
58 | currentIndex++;
59 | if (currentIndex >= upList.size()) {
60 | currentIndex = 0;
61 | }
62 | }
63 |
64 |
65 | if (server == null) {
66 | /*
67 | * The only time this should happen is if the server list were somehow trimmed.
68 | * This is a transient condition. Retry after yielding.
69 | */
70 | Thread.yield();
71 | continue;
72 | }
73 |
74 | if (server.isAlive()) {
75 | return (server);
76 | }
77 |
78 | // Shouldn't actually happen.. but must be transient or a bug.
79 | server = null;
80 | Thread.yield();
81 | }
82 |
83 | return server;
84 |
85 | }
86 |
87 | @Override
88 | public Server choose(Object key) {
89 | return choose(getLoadBalancer(), key);
90 | }
91 |
92 | @Override
93 | public void initWithNiwsConfig(IClientConfig clientConfig) {
94 | // TODO Auto-generated method stub
95 |
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8001/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-provider-dept-8001
13 |
14 |
15 |
16 |
17 | com.atguigu.springcloud
18 | microservicecloud-api
19 | ${project.version}
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-actuator
25 |
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-eureka
30 |
31 |
32 | org.springframework.cloud
33 | spring-cloud-starter-config
34 |
35 |
36 | junit
37 | junit
38 |
39 |
40 | mysql
41 | mysql-connector-java
42 |
43 |
44 | com.alibaba
45 | druid
46 |
47 |
48 | ch.qos.logback
49 | logback-core
50 |
51 |
52 | org.mybatis.spring.boot
53 | mybatis-spring-boot-starter
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-starter-jetty
58 |
59 |
60 | org.springframework.boot
61 | spring-boot-starter-web
62 |
63 |
64 | org.springframework.boot
65 | spring-boot-starter-test
66 |
67 |
68 |
69 | org.springframework
70 | springloaded
71 |
72 |
73 | org.springframework.boot
74 | spring-boot-devtools
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8002/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-provider-dept-8002
13 |
14 |
15 |
16 |
17 | com.atguigu.springcloud
18 | microservicecloud-api
19 | ${project.version}
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-actuator
25 |
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-eureka
30 |
31 |
32 | org.springframework.cloud
33 | spring-cloud-starter-config
34 |
35 |
36 | junit
37 | junit
38 |
39 |
40 | mysql
41 | mysql-connector-java
42 |
43 |
44 | com.alibaba
45 | druid
46 |
47 |
48 | ch.qos.logback
49 | logback-core
50 |
51 |
52 | org.mybatis.spring.boot
53 | mybatis-spring-boot-starter
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-starter-jetty
58 |
59 |
60 | org.springframework.boot
61 | spring-boot-starter-web
62 |
63 |
64 | org.springframework.boot
65 | spring-boot-starter-test
66 |
67 |
68 |
69 | org.springframework
70 | springloaded
71 |
72 |
73 | org.springframework.boot
74 | spring-boot-devtools
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-8003/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | microservicecloud
7 | com.atguigu.springcloud
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | microservicecloud-provider-dept-8003
13 |
14 |
15 |
16 |
17 | com.atguigu.springcloud
18 | microservicecloud-api
19 | ${project.version}
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-actuator
25 |
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-eureka
30 |
31 |
32 | org.springframework.cloud
33 | spring-cloud-starter-config
34 |
35 |
36 | junit
37 | junit
38 |
39 |
40 | mysql
41 | mysql-connector-java
42 |
43 |
44 | com.alibaba
45 | druid
46 |
47 |
48 | ch.qos.logback
49 | logback-core
50 |
51 |
52 | org.mybatis.spring.boot
53 | mybatis-spring-boot-starter
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-starter-jetty
58 |
59 |
60 | org.springframework.boot
61 | spring-boot-starter-web
62 |
63 |
64 | org.springframework.boot
65 | spring-boot-starter-test
66 |
67 |
68 |
69 | org.springframework
70 | springloaded
71 |
72 |
73 | org.springframework.boot
74 | spring-boot-devtools
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/microservicecloud-provider-dept-hystrix-8001/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 |
7 | com.atguigu.springcloud
8 | microservicecloud
9 | 1.0-SNAPSHOT
10 |
11 |
12 | microservicecloud-provider-dept-hystrix-8001
13 |
14 |
15 |
16 |
17 |
18 | org.springframework.cloud
19 | spring-cloud-starter-hystrix
20 |
21 |
22 |
23 | org.springframework.cloud
24 | spring-cloud-starter-eureka
25 |
26 |
27 |
28 | com.atguigu.springcloud
29 | microservicecloud-api
30 | ${project.version}
31 |
32 |
33 | org.springframework.cloud
34 | spring-cloud-starter-config
35 |
36 |
37 |
38 | org.springframework.boot
39 | spring-boot-starter-actuator
40 |
41 |
42 | junit
43 | junit
44 |
45 |
46 | mysql
47 | mysql-connector-java
48 |
49 |
50 | com.alibaba
51 | druid
52 |
53 |
54 | ch.qos.logback
55 | logback-core
56 |
57 |
58 | org.mybatis.spring.boot
59 | mybatis-spring-boot-starter
60 |
61 |
62 | org.springframework.boot
63 | spring-boot-starter-jetty
64 |
65 |
66 | org.springframework.boot
67 | spring-boot-starter-web
68 |
69 |
70 | org.springframework.boot
71 | spring-boot-starter-test
72 |
73 |
74 |
75 | org.springframework
76 | springloaded
77 |
78 |
79 | org.springframework.boot
80 | spring-boot-devtools
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.atguigu.springcloud
8 | microservicecloud
9 | 1.0-SNAPSHOT
10 |
11 | pom
12 |
13 |
14 |
15 | UTF-8
16 | 1.8
17 | 1.8
18 | 4.12
19 | 1.2.17
20 | 1.16.18
21 |
22 |
23 |
24 |
25 |
26 |
27 | org.springframework.cloud
28 | spring-cloud-dependencies
29 | Dalston.SR1
30 | pom
31 | import
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-dependencies
36 | 1.5.9.RELEASE
37 | pom
38 | import
39 |
40 |
41 | mysql
42 | mysql-connector-java
43 | 5.0.4
44 |
45 |
46 | com.alibaba
47 | druid
48 | 1.0.31
49 |
50 |
51 | org.mybatis.spring.boot
52 | mybatis-spring-boot-starter
53 | 1.3.0
54 |
55 |
56 | ch.qos.logback
57 | logback-core
58 | 1.2.3
59 |
60 |
61 | junit
62 | junit
63 | ${junit.version}
64 | test
65 |
66 |
67 | log4j
68 | log4j
69 | ${log4j.version}
70 |
71 |
72 |
73 |
74 |
75 |
76 | microservicecloud
77 |
78 |
79 | src/main/resources
80 | true
81 |
82 |
83 |
84 |
85 | org.apache.maven.plugins
86 | maven-resources-plugin
87 |
88 |
89 | $
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | microservicecloud-api
99 | microservicecloud-provider-dept-8001
100 | microservicecloud-consumer-dept-80
101 | microservicecloud-eureka-7001
102 | microservicecloud-eureka-7002
103 | microservicecloud-eureka-7003
104 | microservicecloud-provider-dept-8002
105 | microservicecloud-provider-dept-8003
106 | microservicecloud-consumer-dept-feign
107 | microservicecloud-provider-dept-hystrix-8001
108 | microservicecloud-consumer-hystrix-dashboard
109 | microservicecloud-zuul-gateway-9527
110 | microservicecloud-config-3344
111 | microservicecloud-config-client-3355
112 | microservicecloud-config-eureka-client-7001
113 | microservicecloud-config-dept-client-8001
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------