Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringCloud-study
提交
9d4457ee
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看板
提交
9d4457ee
编写于
1月 09, 2023
作者:
Q
qinyingjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:微服务启动
上级
8bda5ebb
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
106 addition
and
23 deletion
+106
-23
springcloud-service-common/pom.xml
springcloud-service-common/pom.xml
+6
-0
springcloud-service-eureka/pom.xml
springcloud-service-eureka/pom.xml
+9
-4
springcloud-service-goods/pom.xml
springcloud-service-goods/pom.xml
+17
-12
springcloud-service-goods/src/main/java/com/kwan/springcloud/GoodsApplication.java
.../src/main/java/com/kwan/springcloud/GoodsApplication.java
+2
-0
springcloud-service-goods/src/main/java/com/kwan/springcloud/controller/HelloController.java
...java/com/kwan/springcloud/controller/HelloController.java
+37
-0
springcloud-service-goods/src/main/resources/application.yaml
...ngcloud-service-goods/src/main/resources/application.yaml
+15
-0
springcloud-service-portal/pom.xml
springcloud-service-portal/pom.xml
+7
-6
springcloud-service-portal/src/main/java/com/kwan/springcloud/PortalApplication.java
...src/main/java/com/kwan/springcloud/PortalApplication.java
+2
-0
springcloud-service-portal/src/main/resources/application.yaml
...gcloud-service-portal/src/main/resources/application.yaml
+11
-1
未找到文件。
springcloud-service-common/pom.xml
浏览文件 @
9d4457ee
...
...
@@ -28,6 +28,12 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<!--热部署-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
</dependency>
</dependencies>
...
...
springcloud-service-eureka/pom.xml
浏览文件 @
9d4457ee
...
...
@@ -15,10 +15,6 @@
<spring-cloud.version>
Hoxton.SR12
</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-server
</artifactId>
...
...
@@ -29,6 +25,15 @@
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.kwan.springcloud
</groupId>
<artifactId>
springcloud-service-common
</artifactId>
<version>
1.0.0
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<dependencyManagement>
...
...
springcloud-service-goods/pom.xml
浏览文件 @
9d4457ee
...
...
@@ -23,11 +23,6 @@
<version>
1.0.0
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
...
...
@@ -47,16 +42,26 @@
<version>
8.0.11
</version>
</dependency>
<!--扩展包 -->
<!-- <dependency>-->
<!-- <groupId>com.baomidou</groupId>-->
<!-- <artifactId>mybatis-plus-extension</artifactId>-->
<!-- <version>3.5.2</version>-->
<!-- </dependency>-->
<!--监控-->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-extension
</artifactId>
<version>
3.5.2
</version>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<!--热部署-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-server
</artifactId>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.9.0
</version>
</dependency>
...
...
springcloud-service-goods/src/main/java/com/kwan/springcloud/GoodsApplication.java
浏览文件 @
9d4457ee
...
...
@@ -2,7 +2,9 @@ package com.kwan.springcloud;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
@EnableEurekaClient
@SpringBootApplication
public
class
GoodsApplication
{
...
...
springcloud-service-goods/src/main/java/com/kwan/springcloud/controller/HelloController.java
0 → 100644
浏览文件 @
9d4457ee
package
com.kwan.springcloud.controller
;
import
com.google.gson.Gson
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.client.ServiceInstance
;
import
org.springframework.cloud.client.discovery.DiscoveryClient
;
import
org.springframework.cloud.client.serviceregistry.Registration
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@Slf4j
@RestController
public
class
HelloController
{
@Autowired
private
DiscoveryClient
client
;
@Autowired
private
Registration
registration
;
@RequestMapping
(
"/hello"
)
public
String
index
()
{
List
<
ServiceInstance
>
instances
=
client
.
getInstances
(
registration
.
getServiceId
());
log
.
info
(
new
Gson
().
toJson
(
instances
));
return
"hello world"
;
}
}
springcloud-service-goods/src/main/resources/application.yaml
浏览文件 @
9d4457ee
...
...
@@ -10,6 +10,21 @@ spring:
url
:
jdbc:mysql://localhost:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username
:
root
password
:
716288qwe
application
:
name
:
goods-service
#服务名称
#服务提供者
eureka
:
client
:
service-url
:
defaultZone
:
http://localhost:8766/eureka
management
:
endpoints
:
web
:
base-path
:
/actuator
#修改访问路径 2.0之前默认是/ 2.0默认是 /actuator 可以通过这个属性值修改
health
:
show-details
:
always
#显示健康具体信息 默认不会显示详细信息
#mybatis-plus配置
mybatis-plus
:
...
...
springcloud-service-portal/pom.xml
浏览文件 @
9d4457ee
...
...
@@ -21,18 +21,19 @@
<version>
1.0.0
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-server
</artifactId>
</dependency>
</dependencies>
<build>
...
...
springcloud-service-portal/src/main/java/com/kwan/springcloud/PortalApplication.java
浏览文件 @
9d4457ee
...
...
@@ -2,7 +2,9 @@ package com.kwan.springcloud;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
@EnableEurekaClient
@SpringBootApplication
public
class
PortalApplication
{
...
...
springcloud-service-portal/src/main/resources/application.yaml
浏览文件 @
9d4457ee
#端口号
server
:
port
:
8080
\ No newline at end of file
port
:
8080
spring
:
application
:
name
:
portal-service
#服务名称
#服务提供者
eureka
:
client
:
service-url
:
defaultZone
:
http://localhost:8766/eureka
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录