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
fd596efb
Commit
fd596efb
authored
Aug 23, 2017
by
Jan Thewes
Committed by
Johannes Edmeier
Aug 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to Spring Boot 1.5.6 and Cloud Dalston.SR3
fixes #529
parent
411702e7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
97 deletions
+97
-97
pom.xml
pom.xml
+1
-1
EnableAdminServer.java
...a/de/codecentric/boot/admin/config/EnableAdminServer.java
+2
-1
RevereseZuulProxyConfiguration.java
...ric/boot/admin/config/RevereseZuulProxyConfiguration.java
+94
-95
No files found.
pom.xml
View file @
fd596efb
...
...
@@ -19,7 +19,7 @@
<java.version>
1.7
</java.version>
<main.basedir>
${basedir}
</main.basedir>
<spring-boot.version>
1.5.6.RELEASE
</spring-boot.version>
<spring-cloud.version>
Dalston.SR
2
</spring-cloud.version>
<spring-cloud.version>
Dalston.SR
3
</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/EnableAdminServer.java
View file @
fd596efb
...
...
@@ -20,7 +20,7 @@ import java.lang.annotation.ElementType;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
org.springframework.cloud.netflix.zuul.EnableZuulServer
;
import
org.springframework.context.annotation.Import
;
/**
...
...
@@ -30,6 +30,7 @@ import org.springframework.context.annotation.Import;
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Import
(
AdminServerImportSelector
.
class
)
@EnableZuulServer
public
@interface
EnableAdminServer
{
}
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/RevereseZuulProxyConfiguration.java
View file @
fd596efb
...
...
@@ -15,13 +15,20 @@
*/
package
de
.
codecentric
.
boot
.
admin
.
config
;
import
de.codecentric.boot.admin.event.RoutesOutdatedEvent
;
import
de.codecentric.boot.admin.registry.ApplicationRegistry
;
import
de.codecentric.boot.admin.web.client.HttpHeadersProvider
;
import
de.codecentric.boot.admin.zuul.ApplicationRouteLocator
;
import
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController
;
import
de.codecentric.boot.admin.zuul.filters.pre.ApplicationHeadersFilter
;
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.cloud.netflix.zuul.RoutesEndpoint
;
import
org.springframework.cloud.netflix.zuul.ZuulConfiguration
;
import
org.springframework.cloud.netflix.zuul.Zuul
ServerAuto
Configuration
;
import
org.springframework.cloud.netflix.zuul.filters.ProxyRequestHelper
;
import
org.springframework.cloud.netflix.zuul.filters.RouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.TraceProxyRequestHelper
;
...
...
@@ -36,99 +43,91 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.annotation.Order
;
import
de.codecentric.boot.admin.event.RoutesOutdatedEvent
;
import
de.codecentric.boot.admin.registry.ApplicationRegistry
;
import
de.codecentric.boot.admin.web.client.HttpHeadersProvider
;
import
de.codecentric.boot.admin.zuul.ApplicationRouteLocator
;
import
de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController
;
import
de.codecentric.boot.admin.zuul.filters.pre.ApplicationHeadersFilter
;
@Configuration
@AutoConfigureAfter
({
AdminServerWebConfiguration
.
class
})
public
class
RevereseZuulProxyConfiguration
extends
ZuulConfiguration
{
@Autowired
(
required
=
false
)
private
TraceRepository
traces
;
@Autowired
private
ApplicationRegistry
registry
;
@Autowired
private
AdminServerProperties
adminServer
;
@Bean
@Order
(
0
)
public
ApplicationRouteLocator
applicationRouteLocator
()
{
ApplicationRouteLocator
routeLocator
=
new
ApplicationRouteLocator
(
this
.
server
.
getServletPrefix
(),
registry
,
adminServer
.
getContextPath
()
+
"/api/applications/"
);
routeLocator
.
setEndpoints
(
adminServer
.
getRoutes
().
getEndpoints
());
return
routeLocator
;
}
@Bean
@Override
public
ZuulController
zuulController
()
{
return
new
OptionsDispatchingZuulController
();
}
@Bean
public
ProxyRequestHelper
proxyRequestHelper
()
{
TraceProxyRequestHelper
helper
=
new
TraceProxyRequestHelper
();
if
(
this
.
traces
!=
null
)
{
helper
.
setTraces
(
this
.
traces
);
}
helper
.
setIgnoredHeaders
(
this
.
zuulProperties
.
getIgnoredHeaders
());
helper
.
setTraceRequestBody
(
this
.
zuulProperties
.
isTraceRequestBody
());
return
helper
;
}
// pre filters
@Bean
public
PreDecorationFilter
preDecorationFilter
(
RouteLocator
routeLocator
)
{
return
new
PreDecorationFilter
(
routeLocator
,
this
.
server
.
getServletPrefix
(),
zuulProperties
,
proxyRequestHelper
());
}
@Bean
public
ApplicationHeadersFilter
applicationHeadersFilter
(
ApplicationRouteLocator
routeLocator
,
HttpHeadersProvider
headersProvider
)
{
return
new
ApplicationHeadersFilter
(
headersProvider
,
routeLocator
);
}
@Bean
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
()
{
return
new
SimpleHostRoutingFilter
(
proxyRequestHelper
(),
zuulProperties
);
}
@Bean
@Override
public
ApplicationListener
<
ApplicationEvent
>
zuulRefreshRoutesListener
()
{
return
new
ZuulRefreshListener
(
zuulHandlerMapping
(
null
));
}
@Configuration
@ConditionalOnClass
(
Endpoint
.
class
)
protected
static
class
RoutesEndpointConfiguration
{
@Bean
public
RoutesEndpoint
zuulEndpoint
(
RouteLocator
routeLocator
)
{
return
new
RoutesEndpoint
(
routeLocator
);
}
}
private
static
class
ZuulRefreshListener
implements
ApplicationListener
<
ApplicationEvent
>
{
private
ZuulHandlerMapping
zuulHandlerMapping
;
private
ZuulRefreshListener
(
ZuulHandlerMapping
zuulHandlerMapping
)
{
this
.
zuulHandlerMapping
=
zuulHandlerMapping
;
}
@Override
public
void
onApplicationEvent
(
ApplicationEvent
event
)
{
if
(
event
instanceof
PayloadApplicationEvent
&&
((
PayloadApplicationEvent
<?>)
event
)
.
getPayload
()
instanceof
RoutesOutdatedEvent
)
{
zuulHandlerMapping
.
setDirty
(
true
);
}
}
}
@AutoConfigureAfter
({
AdminServerWebConfiguration
.
class
})
public
class
RevereseZuulProxyConfiguration
extends
ZuulServerAutoConfiguration
{
@Autowired
(
required
=
false
)
private
TraceRepository
traces
;
@Autowired
private
ApplicationRegistry
registry
;
@Autowired
private
AdminServerProperties
adminServer
;
@Bean
@Order
(
0
)
public
ApplicationRouteLocator
applicationRouteLocator
()
{
ApplicationRouteLocator
routeLocator
=
new
ApplicationRouteLocator
(
this
.
server
.
getServletPrefix
(),
registry
,
adminServer
.
getContextPath
()
+
"/api/applications/"
);
routeLocator
.
setEndpoints
(
adminServer
.
getRoutes
().
getEndpoints
());
return
routeLocator
;
}
@Bean
@Override
public
ZuulController
zuulController
()
{
return
new
OptionsDispatchingZuulController
();
}
@Bean
public
ProxyRequestHelper
proxyRequestHelper
()
{
TraceProxyRequestHelper
helper
=
new
TraceProxyRequestHelper
();
if
(
this
.
traces
!=
null
)
{
helper
.
setTraces
(
this
.
traces
);
}
helper
.
setIgnoredHeaders
(
this
.
zuulProperties
.
getIgnoredHeaders
());
helper
.
setTraceRequestBody
(
this
.
zuulProperties
.
isTraceRequestBody
());
return
helper
;
}
// pre filters
@Bean
public
PreDecorationFilter
preDecorationFilter
(
RouteLocator
routeLocator
)
{
return
new
PreDecorationFilter
(
routeLocator
,
this
.
server
.
getServletPrefix
(),
zuulProperties
,
proxyRequestHelper
());
}
@Bean
public
ApplicationHeadersFilter
applicationHeadersFilter
(
ApplicationRouteLocator
routeLocator
,
HttpHeadersProvider
headersProvider
)
{
return
new
ApplicationHeadersFilter
(
headersProvider
,
routeLocator
);
}
@Bean
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
()
{
return
new
SimpleHostRoutingFilter
(
proxyRequestHelper
(),
zuulProperties
);
}
@Bean
@Override
public
ApplicationListener
<
ApplicationEvent
>
zuulRefreshRoutesListener
()
{
return
new
ZuulRefreshListener
(
zuulHandlerMapping
(
null
));
}
@Configuration
@ConditionalOnClass
(
Endpoint
.
class
)
protected
static
class
RoutesEndpointConfiguration
{
@Bean
public
RoutesEndpoint
zuulEndpoint
(
RouteLocator
routeLocator
)
{
return
new
RoutesEndpoint
(
routeLocator
);
}
}
private
static
class
ZuulRefreshListener
implements
ApplicationListener
<
ApplicationEvent
>
{
private
ZuulHandlerMapping
zuulHandlerMapping
;
private
ZuulRefreshListener
(
ZuulHandlerMapping
zuulHandlerMapping
)
{
this
.
zuulHandlerMapping
=
zuulHandlerMapping
;
}
@Override
public
void
onApplicationEvent
(
ApplicationEvent
event
)
{
if
(
event
instanceof
PayloadApplicationEvent
&&
((
PayloadApplicationEvent
<?>)
event
).
getPayload
()
instanceof
RoutesOutdatedEvent
)
{
zuulHandlerMapping
.
setDirty
(
true
);
}
}
}
}
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