Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spring-cloud-learn
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
spring-cloud-learn
Commits
eb72ee58
Commit
eb72ee58
authored
Aug 31, 2019
by
duanledexianxianxian
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update config file
parent
d0ab1805
Pipeline
#110
failed
Changes
12
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
142 additions
and
78 deletions
+142
-78
README.md
README.md
+23
-0
spring-cloud-hello-world/config-server/src/main/java/com/duanledexian/spring/cloud/config/filter/BodyFilter.java
...m/duanledexian/spring/cloud/config/filter/BodyFilter.java
+45
-0
spring-cloud-hello-world/config-server/src/main/java/com/duanledexian/spring/cloud/config/filter/CustometRequestWrapper.java
...an/spring/cloud/config/filter/CustometRequestWrapper.java
+53
-0
spring-cloud-hello-world/hello-config-server/pom.xml
spring-cloud-hello-world/hello-config-server/pom.xml
+0
-29
spring-cloud-hello-world/hello-config-server/src/main/java/com/duanledexian/spring/cloud/config/SpringConfigServiceApplication.java
...n/spring/cloud/config/SpringConfigServiceApplication.java
+0
-26
spring-cloud-hello-world/hello-config-server/src/main/resources/application.yml
...ld/hello-config-server/src/main/resources/application.yml
+0
-20
spring-cloud-hello-world/order-service/pom.xml
spring-cloud-hello-world/order-service/pom.xml
+4
-0
spring-cloud-hello-world/order-service/src/main/resources/application.yml
...lo-world/order-service/src/main/resources/application.yml
+2
-2
spring-cloud-hello-world/order-service/src/main/resources/bootstrap.yml
...ello-world/order-service/src/main/resources/bootstrap.yml
+5
-0
spring-cloud-hello-world/user-service/pom.xml
spring-cloud-hello-world/user-service/pom.xml
+4
-0
spring-cloud-hello-world/user-service/src/main/resources/application.yml
...llo-world/user-service/src/main/resources/application.yml
+1
-1
spring-cloud-hello-world/user-service/src/main/resources/bootstrap.yml
...hello-world/user-service/src/main/resources/bootstrap.yml
+5
-0
No files found.
README.md
View file @
eb72ee58
...
...
@@ -26,6 +26,26 @@ springboot与spring cloud兼容版本
9300-9399:统一配置中心
### 分布式服务跟踪
分布式服务跟踪标准
**Open Tracing**
,与实现平台无关、厂商无关的分布式服务跟踪;
国内的分布式服务跟踪实现:
1.
淘宝的 “鹰眼”
2.
京东的 “Hydra”
3.
大众点评的 “CAT”
4.
新浪的 “Watchman”
5.
唯品会的 “Microscope”
6.
窝窝网的 “Tracing”
### 启动内网穿透
1.
下载工具,地址https://github.com/open-dingtalk/pierced
2.
进入windows_64目录
3.
运行 ding.exe -config=./ding.cfg -subdomain=duanledexian 9300
### 问题
...
...
@@ -49,4 +69,7 @@ springboot与spring cloud兼容版本
### 参考
1.
https://windmt.com/2018/04/14/spring-cloud-1-services-governance/
2.
https://blog.csdn.net/libertine1993/article/details/80765886
3.
https://www.jianshu.com/p/e148afe66367
4.
https://natapp.cn/article/natapp_newbie
5.
https://my.oschina.net/u/3266761/blog/2245498
spring-cloud-hello-world/config-server/src/main/java/com/duanledexian/spring/cloud/config/filter/BodyFilter.java
0 → 100644
View file @
eb72ee58
package
com.duanledexian.spring.cloud.config.filter
;
import
org.springframework.core.annotation.Order
;
import
javax.servlet.*
;
import
javax.servlet.annotation.WebFilter
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
/**
* @author duanledexianxianxian
* @date 2019/8/31 1:32
* @since 1.0.0
*/
@WebFilter
(
filterName
=
"bodyFilter"
,
urlPatterns
=
"/*"
)
@Order
(
1
)
public
class
BodyFilter
implements
Filter
{
@Override
public
void
init
(
FilterConfig
filterConfig
)
throws
ServletException
{
}
@Override
public
void
doFilter
(
ServletRequest
servletRequest
,
ServletResponse
servletResponse
,
FilterChain
filterChain
)
throws
IOException
,
ServletException
{
HttpServletRequest
httpServletRequest
=
(
HttpServletRequest
)
servletRequest
;
String
url
=
new
String
(
httpServletRequest
.
getRequestURI
());
//只过滤/actuator/bus-refresh请求
if
(!
url
.
endsWith
(
"/bus-refresh"
))
{
filterChain
.
doFilter
(
servletRequest
,
servletResponse
);
return
;
}
//使用HttpServletRequest包装原始请求达到修改post请求中body内容的目的
CustometRequestWrapper
requestWrapper
=
new
CustometRequestWrapper
(
httpServletRequest
);
filterChain
.
doFilter
(
requestWrapper
,
servletResponse
);
}
@Override
public
void
destroy
()
{
}
}
spring-cloud-hello-world/config-server/src/main/java/com/duanledexian/spring/cloud/config/filter/CustometRequestWrapper.java
0 → 100644
View file @
eb72ee58
package
com.duanledexian.spring.cloud.config.filter
;
import
javax.servlet.ReadListener
;
import
javax.servlet.ServletInputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequestWrapper
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
/**
* @author duanledexianxianxian
* @date 2019/8/31 1:31
* @since 1.0.0
*/
public
class
CustometRequestWrapper
extends
HttpServletRequestWrapper
{
/**
* Constructs a request object wrapping the given request.
*
* @param request The request to wrap
* @throws IllegalArgumentException if the request is null
*/
public
CustometRequestWrapper
(
HttpServletRequest
request
)
{
super
(
request
);
}
@Override
public
ServletInputStream
getInputStream
()
throws
IOException
{
byte
[]
bytes
=
new
byte
[
0
];
ByteArrayInputStream
byteArrayInputStream
=
new
ByteArrayInputStream
(
bytes
);
return
new
ServletInputStream
()
{
@Override
public
boolean
isFinished
()
{
return
byteArrayInputStream
.
read
()
==
-
1
?
true
:
false
;
}
@Override
public
boolean
isReady
()
{
return
false
;
}
@Override
public
void
setReadListener
(
ReadListener
readListener
)
{
}
@Override
public
int
read
()
throws
IOException
{
return
byteArrayInputStream
.
read
();
}
};
}
}
spring-cloud-hello-world/hello-config-server/pom.xml
deleted
100644 → 0
View file @
d0ab1805
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
spring-cloud-hello-world
</artifactId>
<groupId>
com.duanledexian.spring.cloud
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
hello-config-server
</artifactId>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-config-server
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
</dependencies>
</project>
spring-cloud-hello-world/hello-config-server/src/main/java/com/duanledexian/spring/cloud/config/SpringConfigServiceApplication.java
deleted
100644 → 0
View file @
d0ab1805
package
com.duanledexian.spring.cloud.config
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.config.server.EnableConfigServer
;
/**
* 配置服务中心
* <p>@EnableConfigServer 激活对配置中心的支持</p>
*
* @author Administrator
* @version 1.0.0
*/
@SpringBootApplication
@EnableConfigServer
public
class
SpringConfigServiceApplication
{
/**
* The entry point of application.
*
* @param args the input arguments
*/
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SpringConfigServiceApplication
.
class
,
args
);
}
}
spring-cloud-hello-world/hello-config-server/src/main/resources/application.yml
deleted
100644 → 0
View file @
d0ab1805
server
:
# 服务器端口
port
:
9300
eureka
:
client
:
service-url
:
defaultZone
:
http://localhost:9000/eureka/
spring
:
application
:
name
:
config-server
cloud
:
config
:
server
:
git
:
# 配置git仓库的地址
uri
:
http://platform.kuopu.net:9999/gitlab/duanledexianxianxian/spring-cloud-learn.git
# git仓库地址下的相对地址,可以配置多个,用,分割。
search-paths
:
spring-cloud-hello-world/config-repo
skip-ssl-validation
:
false
spring-cloud-hello-world/order-service/pom.xml
View file @
eb72ee58
...
...
@@ -32,5 +32,9 @@
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-bus-amqp
</artifactId>
</dependency>
</dependencies>
</project>
spring-cloud-hello-world/order-service/src/main/resources/application.yml
View file @
eb72ee58
...
...
@@ -3,7 +3,7 @@ server:
port
:
9204
hello
:
name
:
"
order
application
default
name"
name
:
"
order
application
default
name
version
2
"
spring
:
application
:
...
...
@@ -12,4 +12,4 @@ management:
endpoints
:
web
:
exposure
:
include
:
refresh,
info
include
:
refresh,
bus-refresh,info,health
spring-cloud-hello-world/order-service/src/main/resources/bootstrap.yml
View file @
eb72ee58
...
...
@@ -12,6 +12,11 @@ spring:
discovery
:
enabled
:
true
service-id
:
config-server
rabbitmq
:
port
:
9005
username
:
admin
password
:
"
!admin!"
host
:
113.105.144.9
eureka
:
client
:
...
...
spring-cloud-hello-world/user-service/pom.xml
View file @
eb72ee58
...
...
@@ -32,6 +32,10 @@
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-bus-amqp
</artifactId>
</dependency>
</dependencies>
</project>
spring-cloud-hello-world/user-service/src/main/resources/application.yml
View file @
eb72ee58
...
...
@@ -12,4 +12,4 @@ management:
endpoints
:
web
:
exposure
:
include
:
refresh
include
:
refresh
,bus-refresh,info,health
spring-cloud-hello-world/user-service/src/main/resources/bootstrap.yml
View file @
eb72ee58
...
...
@@ -12,6 +12,11 @@ spring:
discovery
:
enabled
:
true
service-id
:
config-server
rabbitmq
:
port
:
9005
username
:
admin
password
:
"
!admin!"
host
:
113.105.144.9
eureka
:
client
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment