Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringCloud-study
提交
c6736811
S
SpringCloud-study
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringCloud-study
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringCloud-study
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
c6736811
编写于
1月 10, 2023
作者:
Q
qinyingjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:自定义负载均衡
上级
437f9531
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
101 addition
and
2 deletion
+101
-2
pom.xml
pom.xml
+1
-0
springcloud-service-common/pom.xml
springcloud-service-common/pom.xml
+4
-0
springcloud-service-common/src/main/java/com/kwan/springcloud/config/RestConfig.java
...src/main/java/com/kwan/springcloud/config/RestConfig.java
+11
-1
springcloud-service-portal/pom.xml
springcloud-service-portal/pom.xml
+1
-1
springcloud-service-zuul/pom.xml
springcloud-service-zuul/pom.xml
+45
-0
springcloud-service-zuul/src/main/java/com/kwan/springcloud/ZuulApplication.java
...l/src/main/java/com/kwan/springcloud/ZuulApplication.java
+13
-0
springcloud-service-zuul/src/main/resources/application.yaml
springcloud-service-zuul/src/main/resources/application.yaml
+13
-0
springcloud-service-zuul/src/test/java/com/kwan/springcloud/PortalApplicationTests.java
...est/java/com/kwan/springcloud/PortalApplicationTests.java
+13
-0
未找到文件。
pom.xml
浏览文件 @
c6736811
...
...
@@ -33,6 +33,7 @@
<module>
springcloud-service-config
</module>
<module>
springcloud-service-config-client
</module>
<module>
springcloud-service-feign
</module>
<module>
springcloud-service-zuul
</module>
<module>
springcloud-service-eureka
</module>
</modules>
...
...
springcloud-service-common/pom.xml
浏览文件 @
c6736811
...
...
@@ -45,6 +45,10 @@
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-commons
</artifactId>
</dependency>
<dependency>
<groupId>
com.netflix.ribbon
</groupId>
<artifactId>
ribbon-loadbalancer
</artifactId>
</dependency>
</dependencies>
...
...
springcloud-service-common/src/main/java/com/kwan/springcloud/config/RestConfig.java
浏览文件 @
c6736811
package
com.kwan.springcloud.config
;
import
com.netflix.loadbalancer.IRule
;
import
com.netflix.loadbalancer.RandomRule
;
import
org.springframework.cloud.client.loadbalancer.LoadBalanced
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -13,4 +15,12 @@ public class RestConfig {
public
RestTemplate
restTemplate
()
{
return
new
RestTemplate
();
}
}
/**
* 自定义负载均衡
*/
@Bean
public
IRule
microIrule
()
{
return
new
RandomRule
();
}
}
\ No newline at end of file
springcloud-service-portal/pom.xml
浏览文件 @
c6736811
...
...
@@ -27,7 +27,7 @@
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-
server
</artifactId>
<artifactId>
spring-cloud-starter-netflix-eureka-
client
</artifactId>
</dependency>
</dependencies>
...
...
springcloud-service-zuul/pom.xml
0 → 100644
浏览文件 @
c6736811
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.kwan.springcloud
</groupId>
<artifactId>
springcloud-service-parent
</artifactId>
<version>
1.0.0
</version>
</parent>
<artifactId>
springcloud-service-zuul
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<name>
springcloud-service-zuul
</name>
<properties>
<java.version>
1.8
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
com.kwan.springcloud
</groupId>
<artifactId>
springcloud-service-common
</artifactId>
<version>
1.0.0
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-zuul
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
springcloud-service-zuul/src/main/java/com/kwan/springcloud/ZuulApplication.java
0 → 100644
浏览文件 @
c6736811
package
com.kwan.springcloud
;
@EnableZuulProxy
@SpringBootApplication
public
class
ZuulApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
ZuulApplication
.
class
,
args
);
}
}
springcloud-service-zuul/src/main/resources/application.yaml
0 → 100644
浏览文件 @
c6736811
#端口号
server
:
port
:
8888
spring
:
application
:
name
:
zuul-service
#服务名称
#服务提供者
eureka
:
client
:
service-url
:
defaultZone
:
http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
\ No newline at end of file
springcloud-service-zuul/src/test/java/com/kwan/springcloud/PortalApplicationTests.java
0 → 100644
浏览文件 @
c6736811
package
com.kwan.springcloud
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
@SpringBootTest
class
PortalApplicationTests
{
@Test
void
contextLoads
()
{
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录