Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-boot-admin
Commits
245c256f
Commit
245c256f
authored
Nov 30, 2017
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to Spring Boot 1.5.9 and Spring Cloud Edgware.RELEASE
closes #597
parent
121d4755
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
24 deletions
+51
-24
pom.xml
pom.xml
+3
-3
RevereseZuulProxyConfiguration.java
...ric/boot/admin/config/RevereseZuulProxyConfiguration.java
+24
-2
ApplicationRouteLocatorTest.java
...ecentric/boot/admin/zuul/ApplicationRouteLocatorTest.java
+24
-19
No files found.
pom.xml
View file @
245c256f
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.5.
8
.RELEASE
</version>
<version>
1.5.
9
.RELEASE
</version>
<relativePath/>
</parent>
<groupId>
de.codecentric
</groupId>
...
...
@@ -18,8 +18,8 @@
<properties>
<java.version>
1.7
</java.version>
<main.basedir>
${basedir}
</main.basedir>
<spring-boot.version>
1.5.
8
.RELEASE
</spring-boot.version>
<spring-cloud.version>
Dalston.SR4
</spring-cloud.version>
<spring-boot.version>
1.5.
9
.RELEASE
</spring-boot.version>
<spring-cloud.version>
Edgware.RELEASE
</spring-cloud.version>
<hystrix-dashboard.version>
1.5.5
</hystrix-dashboard.version>
<build-plugin.jacoco.version>
0.7.9
</build-plugin.jacoco.version>
<build-plugin.coveralls.version>
4.3.0
</build-plugin.coveralls.version>
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/RevereseZuulProxyConfiguration.java
View file @
245c256f
...
...
@@ -21,16 +21,22 @@ import de.codecentric.boot.admin.web.client.HttpHeadersProvider;
import
de.codecentric.boot.admin.zuul.ApplicationRouteLocator
;
import
de.codecentric.boot.admin.zuul.filters.pre.ApplicationHeadersFilter
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.trace.TraceRepository
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.cloud.commons.httpclient.ApacheHttpClientConnectionManagerFactory
;
import
org.springframework.cloud.commons.httpclient.ApacheHttpClientFactory
;
import
org.springframework.cloud.commons.httpclient.HttpClientConfiguration
;
import
org.springframework.cloud.netflix.zuul.RoutesEndpoint
;
import
org.springframework.cloud.netflix.zuul.ZuulServerAutoConfiguration
;
import
org.springframework.cloud.netflix.zuul.filters.ProxyRequestHelper
;
import
org.springframework.cloud.netflix.zuul.filters.RouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.TraceProxyRequestHelper
;
import
org.springframework.cloud.netflix.zuul.filters.ZuulProperties
;
import
org.springframework.cloud.netflix.zuul.filters.pre.PreDecorationFilter
;
import
org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilter
;
import
org.springframework.cloud.netflix.zuul.web.ZuulHandlerMapping
;
...
...
@@ -39,10 +45,12 @@ import org.springframework.context.ApplicationListener;
import
org.springframework.context.PayloadApplicationEvent
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.core.annotation.Order
;
@Configuration
@AutoConfigureAfter
({
AdminServerWebConfiguration
.
class
})
@Import
(
HttpClientConfiguration
.
class
)
public
class
RevereseZuulProxyConfiguration
extends
ZuulServerAutoConfiguration
{
@Autowired
(
required
=
false
)
...
...
@@ -88,8 +96,22 @@ public class RevereseZuulProxyConfiguration extends ZuulServerAutoConfiguration
}
@Bean
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
()
{
return
new
SimpleHostRoutingFilter
(
proxyRequestHelper
(),
zuulProperties
);
@ConditionalOnMissingBean
({
SimpleHostRoutingFilter
.
class
,
CloseableHttpClient
.
class
})
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
(
ProxyRequestHelper
helper
,
ZuulProperties
zuulProperties
,
ApacheHttpClientConnectionManagerFactory
connectionManagerFactory
,
ApacheHttpClientFactory
httpClientFactory
)
{
return
new
SimpleHostRoutingFilter
(
helper
,
zuulProperties
,
connectionManagerFactory
,
httpClientFactory
);
}
@Bean
@ConditionalOnMissingBean
({
SimpleHostRoutingFilter
.
class
})
public
SimpleHostRoutingFilter
simpleHostRoutingFilter2
(
ProxyRequestHelper
helper
,
ZuulProperties
zuulProperties
,
CloseableHttpClient
httpClient
)
{
return
new
SimpleHostRoutingFilter
(
helper
,
zuulProperties
,
httpClient
);
}
@Bean
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/zuul/ApplicationRouteLocatorTest.java
View file @
245c256f
...
...
@@ -32,6 +32,7 @@ import org.springframework.cloud.netflix.zuul.filters.Route;
import
de.codecentric.boot.admin.model.Application
;
import
de.codecentric.boot.admin.registry.ApplicationRegistry
;
import
de.codecentric.boot.admin.zuul.ApplicationRouteLocator.ApplicationRoute
;
public
class
ApplicationRouteLocatorTest
{
...
...
@@ -47,42 +48,46 @@ public class ApplicationRouteLocatorTest {
@Test
public
void
getRoutes_healthOnly
()
{
when
(
registry
.
getApplications
()).
thenReturn
(
singletonList
(
Application
.
create
(
"app1"
)
.
withHealthUrl
(
"http://localhost/health"
).
withId
(
"1234"
).
build
()));
Application
application
=
Application
.
create
(
"app1"
)
.
withHealthUrl
(
"http://localhost/health"
)
.
withId
(
"1234"
)
.
build
();
when
(
registry
.
getApplications
()).
thenReturn
(
singletonList
(
application
));
assertEquals
(
1
,
locator
.
getRoutes
().
size
());
assertEquals
(
asList
(
new
Route
(
"1234-health"
,
"/**"
,
"http://localhost/health"
,
"/api/applications/1234/health"
,
false
,
null
)),
locator
.
getRoutes
());
assertEquals
(
singletonList
(
new
ApplicationRoute
(
application
,
"1234-health"
,
"/**"
,
"http://localhost/health"
,
"/api/applications/1234/health"
)),
locator
.
getRoutes
());
Route
matchingRoute
=
locator
.
getMatchingRoute
(
"/api/applications/1234/health"
);
assertEquals
(
new
Route
(
"1234-health"
,
""
,
"http://localhost/health"
,
"/api/applications/1234/health"
,
false
,
null
),
matchingRoute
);
assertEquals
(
new
ApplicationRoute
(
application
,
"1234-health"
,
""
,
"http://localhost/health"
,
"/api/applications/1234/health"
),
matchingRoute
);
assertNull
(
locator
.
getMatchingRoute
(
"/api/applications/1234/danger"
));
}
@Test
public
void
getRoutes
()
{
when
(
registry
.
getApplications
()).
thenReturn
(
singletonList
(
Application
.
create
(
"app1"
).
withHealthUrl
(
"http://localhost/health"
)
.
withManagementUrl
(
"http://localhost"
).
withId
(
"1234"
).
build
()));
Application
application
=
Application
.
create
(
"app1"
)
.
withHealthUrl
(
"http://localhost/health"
)
.
withManagementUrl
(
"http://localhost"
)
.
withId
(
"1234"
)
.
build
();
when
(
registry
.
getApplications
()).
thenReturn
(
singletonList
(
application
));
assertEquals
(
2
,
locator
.
getRoutes
().
size
());
assertEquals
(
asList
(
new
Route
(
"1234-health"
,
"/**"
,
"http://localhost/health"
,
"/api/applications/1234/health"
,
false
,
null
),
new
Route
(
"1234-env"
,
"/**"
,
"http://localhost/env"
,
"/api/applications/1234/env"
,
false
,
null
)),
locator
.
getRoutes
());
assertEquals
(
asList
(
new
ApplicationRoute
(
application
,
"1234-health"
,
"/**"
,
"http://localhost/health"
,
"/api/applications/1234/health"
),
new
ApplicationRoute
(
application
,
"1234-env"
,
"/**"
,
"http://localhost/env"
,
"/api/applications/1234/env"
)),
locator
.
getRoutes
());
Route
matchingHealth
=
locator
.
getMatchingRoute
(
"/api/applications/1234/health"
);
assertEquals
(
new
Route
(
"1234-health"
,
""
,
"http://localhost/health"
,
"/api/applications/1234/health"
,
false
,
null
),
matchingHealth
);
assertEquals
(
new
ApplicationRoute
(
application
,
"1234-health"
,
""
,
"http://localhost/health"
,
"/api/applications/1234/health"
),
matchingHealth
);
Route
matchingEnv
=
locator
.
getMatchingRoute
(
"/api/applications/1234/env/reset"
);
assertEquals
(
new
Route
(
"1234-env"
,
"/reset"
,
"http://localhost/env"
,
"/api/applications/1234/env"
,
false
,
null
),
matchingEnv
);
assertEquals
(
new
ApplicationRoute
(
application
,
"1234-env"
,
"/reset"
,
"http://localhost/env"
,
"/api/applications/1234/env"
),
matchingEnv
);
assertNull
(
locator
.
getMatchingRoute
(
"/api/applications/1234/danger"
));
}
...
...
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