# alternative-spring-boot **Repository Path**: bufan1/alternative-spring-boot ## Basic Information - **Project Name**: alternative-spring-boot - **Description**: 同类服务聚合调用框架。 - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-04-29 - **Last Updated**: 2022-05-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # alternative-springboot #### 介绍 同类服务聚合调用框架。调用同一类服务,如查询用户信用分时,项目同时存在微信和支付宝两种方式,框架提供此类服务的注解引用调用和负载均衡 #### 使用教程 1. 引入依赖 ``` com.bufan alternative-spring-boot-starter 1.0-SNAPSHOT ``` 2. 注解调用 ``` @Reference(loadbalance = "round") TestService testService; @RequestMapping("/test") public Object test() { return testService.print(); } ``` 3. 增加自定义负载均衡算法 ``` @Bean MyRandomLoadBalance myRandomLoadBalance(){ return new MyRandomLoadBalance(); } ``` #### 使用说明 1. demo样例中TestService为接口,且有一个或者多个实现注入spring容器,加上@reference注解后框架可以自动识别其实现并根据负载均衡要求调用。