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
b4b298d7
Commit
b4b298d7
authored
May 18, 2015
by
Johannes Stelzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split configuration into separate files
parent
ceea2d2d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
359 additions
and
260 deletions
+359
-260
AdminServerWebConfiguration.java
...entric/boot/admin/config/AdminServerWebConfiguration.java
+2
-258
DiscoveryClientConfiguration.java
...ntric/boot/admin/config/DiscoveryClientConfiguration.java
+54
-0
HazelcastStoreConfiguration.java
...entric/boot/admin/config/HazelcastStoreConfiguration.java
+109
-0
RevereseZuulProxyConfiguration.java
...ric/boot/admin/config/RevereseZuulProxyConfiguration.java
+158
-0
SimpleStoreConfig.java
...a/de/codecentric/boot/admin/config/SimpleStoreConfig.java
+34
-0
additional-spring-configuration-metadata.json
...es/META-INF/additional-spring-configuration-metadata.json
+2
-2
No files found.
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/AdminServerWebConfiguration.java
View file @
b4b298d7
This diff is collapsed.
Click to expand it.
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/DiscoveryClientConfiguration.java
0 → 100644
View file @
b4b298d7
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
de
.
codecentric
.
boot
.
admin
.
config
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.cloud.client.discovery.DiscoveryClient
;
import
org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration
;
import
org.springframework.context.ApplicationEvent
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
de.codecentric.boot.admin.discovery.ApplicationDiscoveryListener
;
import
de.codecentric.boot.admin.registry.ApplicationRegistry
;
@Configuration
@ConditionalOnClass
({
DiscoveryClient
.
class
})
@ConditionalOnProperty
(
prefix
=
"spring.boot.admin.discovery"
,
name
=
"enabled"
,
matchIfMissing
=
true
)
@AutoConfigureAfter
({
NoopDiscoveryClientAutoConfiguration
.
class
})
public
class
DiscoveryClientConfiguration
{
@Value
(
"${spring.boot.admin.discovery.management.context-path:}"
)
private
String
managementPath
;
@Autowired
private
DiscoveryClient
discoveryClient
;
@Autowired
private
ApplicationRegistry
registry
;
@Bean
ApplicationListener
<
ApplicationEvent
>
applicationDiscoveryListener
()
{
ApplicationDiscoveryListener
listener
=
new
ApplicationDiscoveryListener
(
discoveryClient
,
registry
);
listener
.
setManagementContextPath
(
managementPath
);
return
listener
;
}
}
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/HazelcastStoreConfiguration.java
0 → 100644
View file @
b4b298d7
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
de
.
codecentric
.
boot
.
admin
.
config
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
com.hazelcast.config.Config
;
import
com.hazelcast.core.EntryEvent
;
import
com.hazelcast.core.EntryListener
;
import
com.hazelcast.core.Hazelcast
;
import
com.hazelcast.core.HazelcastInstance
;
import
com.hazelcast.core.IMap
;
import
com.hazelcast.core.MapEvent
;
import
de.codecentric.boot.admin.event.ClientApplicationRegisteredEvent
;
import
de.codecentric.boot.admin.event.ClientApplicationUnregisteredEvent
;
import
de.codecentric.boot.admin.model.Application
;
import
de.codecentric.boot.admin.registry.store.ApplicationStore
;
import
de.codecentric.boot.admin.registry.store.HazelcastApplicationStore
;
@Configuration
@ConditionalOnClass
({
Hazelcast
.
class
})
@ConditionalOnProperty
(
prefix
=
"spring.boot.admin.hazelcast"
,
name
=
"enabled"
,
matchIfMissing
=
true
)
public
class
HazelcastStoreConfiguration
{
@Value
(
"${spring.boot.admin.hazelcast.map:spring-boot-admin-application-store}"
)
private
String
hazelcastMapName
;
@Bean
@ConditionalOnMissingBean
public
Config
hazelcastConfig
()
{
return
new
Config
();
}
@Bean
(
destroyMethod
=
"shutdown"
)
@ConditionalOnMissingBean
public
HazelcastInstance
hazelcastInstance
(
Config
hazelcastConfig
)
{
return
Hazelcast
.
newHazelcastInstance
(
hazelcastConfig
);
}
@Bean
@ConditionalOnMissingBean
public
ApplicationStore
applicationStore
(
HazelcastInstance
hazelcast
)
{
IMap
<
String
,
Application
>
map
=
hazelcast
.<
String
,
Application
>
getMap
(
hazelcastMapName
);
map
.
addIndex
(
"name"
,
false
);
map
.
addEntryListener
(
entryListener
(),
false
);
return
new
HazelcastApplicationStore
(
map
);
}
@Bean
public
EntryListener
<
String
,
Application
>
entryListener
()
{
return
new
ApplicationEntryListener
();
}
private
static
class
ApplicationEntryListener
implements
EntryListener
<
String
,
Application
>
{
@Autowired
ApplicationEventPublisher
publisher
;
@Override
public
void
entryAdded
(
EntryEvent
<
String
,
Application
>
event
)
{
publisher
.
publishEvent
(
new
ClientApplicationRegisteredEvent
(
this
,
event
.
getValue
()));
}
@Override
public
void
entryRemoved
(
EntryEvent
<
String
,
Application
>
event
)
{
publisher
.
publishEvent
(
new
ClientApplicationUnregisteredEvent
(
this
,
event
.
getValue
()));
}
@Override
public
void
entryUpdated
(
EntryEvent
<
String
,
Application
>
event
)
{
publisher
.
publishEvent
(
new
ClientApplicationRegisteredEvent
(
this
,
event
.
getValue
()));
}
@Override
public
void
entryEvicted
(
EntryEvent
<
String
,
Application
>
event
)
{
publisher
.
publishEvent
(
new
ClientApplicationRegisteredEvent
(
this
,
null
));
}
@Override
public
void
mapEvicted
(
MapEvent
event
)
{
publisher
.
publishEvent
(
new
ClientApplicationRegisteredEvent
(
this
,
null
));
}
@Override
public
void
mapCleared
(
MapEvent
event
)
{
publisher
.
publishEvent
(
new
ClientApplicationRegisteredEvent
(
this
,
null
));
}
}
}
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/RevereseZuulProxyConfiguration.java
0 → 100644
View file @
b4b298d7
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
de
.
codecentric
.
boot
.
admin
.
config
;
import
java.util.Map
;
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.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cloud.netflix.zuul.RoutesEndpoint
;
import
org.springframework.cloud.netflix.zuul.ZuulFilterInitializer
;
import
org.springframework.cloud.netflix.zuul.filters.ProxyRequestHelper
;
import
org.springframework.cloud.netflix.zuul.filters.ProxyRouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.RouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.ZuulProperties
;
import
org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter
;
import
org.springframework.cloud.netflix.zuul.filters.post.SendResponseFilter
;
import
org.springframework.cloud.netflix.zuul.filters.pre.DebugFilter
;
import
org.springframework.cloud.netflix.zuul.filters.pre.FormBodyWrapperFilter
;
import
org.springframework.cloud.netflix.zuul.filters.pre.PreDecorationFilter
;
import
org.springframework.cloud.netflix.zuul.filters.pre.Servlet30WrapperFilter
;
import
org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilter
;
import
org.springframework.cloud.netflix.zuul.web.ZuulController
;
import
org.springframework.cloud.netflix.zuul.web.ZuulHandlerMapping
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
com.netflix.zuul.ZuulFilter
;
import
de.codecentric.boot.admin.controller.RegistryController
;
import
de.codecentric.boot.admin.registry.ApplicationRegistry
;
import
de.codecentric.boot.admin.zuul.ApplicationRouteLocator
;
import
de.codecentric.boot.admin.zuul.ApplicationRouteRefreshListener
;
@Configuration
@EnableConfigurationProperties
(
ZuulProperties
.
class
)
public
class
RevereseZuulProxyConfiguration
{
@Autowired
(
required
=
false
)
private
TraceRepository
traces
;
@Autowired
private
ZuulProperties
zuulProperties
;
@Autowired
private
ServerProperties
server
;
@Autowired
private
ApplicationRegistry
registry
;
@Bean
public
ApplicationRouteLocator
routeLocator
()
{
return
new
ApplicationRouteLocator
(
this
.
server
.
getServletPrefix
(),
registry
,
this
.
zuulProperties
,
RegistryController
.
PATH
);
}
@Bean
public
PreDecorationFilter
preDecorationFilter
()
{
return
new
PreDecorationFilter
(
routeLocator
(),
this
.
zuulProperties
.
isAddProxyHeaders
());
}
@Bean
public
SimpleHostRoutingFilter
simpleHostRoutingFilter
()
{
ProxyRequestHelper
helper
=
new
ProxyRequestHelper
();
if
(
this
.
traces
!=
null
)
{
helper
.
setTraces
(
this
.
traces
);
}
return
new
SimpleHostRoutingFilter
(
helper
);
}
@Bean
public
ZuulController
zuulController
()
{
return
new
ZuulController
();
}
@Bean
public
ZuulHandlerMapping
zuulHandlerMapping
(
RouteLocator
routes
)
{
return
new
ZuulHandlerMapping
(
routes
,
zuulController
());
}
// pre filters
@Bean
public
FormBodyWrapperFilter
formBodyWrapperFilter
()
{
return
new
FormBodyWrapperFilter
();
}
@Bean
public
DebugFilter
debugFilter
()
{
return
new
DebugFilter
();
}
@Bean
public
Servlet30WrapperFilter
servlet30WrapperFilter
()
{
return
new
Servlet30WrapperFilter
();
}
// post filters
@Bean
public
SendResponseFilter
sendResponseFilter
()
{
return
new
SendResponseFilter
();
}
@Bean
public
SendErrorFilter
sendErrorFilter
()
{
return
new
SendErrorFilter
();
}
@Configuration
protected
static
class
ZuulFilterConfiguration
{
@Autowired
private
Map
<
String
,
ZuulFilter
>
filters
;
@Bean
public
ZuulFilterInitializer
zuulFilterInitializer
()
{
return
new
ZuulFilterInitializer
(
this
.
filters
);
}
}
@Bean
public
ApplicationRouteRefreshListener
applicationRouteRefreshListener
()
{
return
new
ApplicationRouteRefreshListener
(
routeLocator
(),
zuulHandlerMapping
(
routeLocator
()));
}
@Configuration
@ConditionalOnClass
(
Endpoint
.
class
)
protected
static
class
RoutesEndpointConfiguration
{
@Autowired
private
ProxyRouteLocator
routeLocator
;
@Bean
public
RoutesEndpoint
zuulEndpoint
()
{
return
new
RoutesEndpoint
(
this
.
routeLocator
);
}
}
}
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/SimpleStoreConfig.java
0 → 100644
View file @
b4b298d7
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
de
.
codecentric
.
boot
.
admin
.
config
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
de.codecentric.boot.admin.registry.store.ApplicationStore
;
import
de.codecentric.boot.admin.registry.store.SimpleApplicationStore
;
@Configuration
@AutoConfigureAfter
({
HazelcastStoreConfiguration
.
class
})
public
class
SimpleStoreConfig
{
@Bean
@ConditionalOnMissingBean
public
ApplicationStore
applicationStore
()
{
return
new
SimpleApplicationStore
();
}
}
spring-boot-admin-server/src/main/resources/META-INF/additional-spring-configuration-metadata.json
View file @
b4b298d7
{
"groups"
:
[
{
"name"
:
"spring.boot.admin.hazelcast"
,
"sourceType"
:
"de.codecentric.boot.admin.config.
AdminServerWebConfiguration.
HazelcastStoreConfiguration"
"sourceType"
:
"de.codecentric.boot.admin.config.HazelcastStoreConfiguration"
},
{
"name"
:
"spring.boot.admin.discovery"
,
"sourceType"
:
"de.codecentric.boot.admin.config.
AdminServerWebConfiguration.
DiscoveryClientConfiguration"
"sourceType"
:
"de.codecentric.boot.admin.config.DiscoveryClientConfiguration"
}
],
"properties"
:
[
{
...
...
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