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
fef76a64
Commit
fef76a64
authored
Dec 24, 2016
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract core- from web-config
parent
d49f16a0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
162 additions
and
133 deletions
+162
-133
TurbineAutoConfigurationTest.java
...ot/admin/turbine/config/TurbineAutoConfigurationTest.java
+2
-0
AdminServerCoreConfiguration.java
...ntric/boot/admin/config/AdminServerCoreConfiguration.java
+130
-0
AdminServerImportSelector.java
...ecentric/boot/admin/config/AdminServerImportSelector.java
+1
-0
AdminServerWebConfiguration.java
...entric/boot/admin/config/AdminServerWebConfiguration.java
+23
-131
AdminServerWebConfigurationTest.java
...ic/boot/admin/config/AdminServerWebConfigurationTest.java
+5
-2
DiscoveryClientConfigurationTest.java
...c/boot/admin/config/DiscoveryClientConfigurationTest.java
+1
-0
No files found.
spring-boot-admin-server-ui-turbine/src/test/java/spring/boot/admin/turbine/config/TurbineAutoConfigurationTest.java
View file @
fef76a64
...
...
@@ -12,6 +12,7 @@ import org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration.Res
import
org.springframework.boot.test.util.EnvironmentTestUtils
;
import
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
;
import
de.codecentric.boot.admin.config.AdminServerCoreConfiguration
;
import
de.codecentric.boot.admin.config.AdminServerWebConfiguration
;
import
de.codecentric.boot.admin.config.RevereseZuulProxyConfiguration
;
import
spring.boot.admin.turbine.web.TurbineController
;
...
...
@@ -51,6 +52,7 @@ public class TurbineAutoConfigurationTest {
applicationContext
.
register
(
PropertyPlaceholderAutoConfiguration
.
class
);
applicationContext
.
register
(
RestTemplateConfiguration
.
class
);
applicationContext
.
register
(
ServerPropertiesAutoConfiguration
.
class
);
applicationContext
.
register
(
AdminServerCoreConfiguration
.
class
);
applicationContext
.
register
(
AdminServerWebConfiguration
.
class
);
applicationContext
.
register
(
RevereseZuulProxyConfiguration
.
class
);
applicationContext
.
register
(
TurbineAutoConfiguration
.
class
);
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/AdminServerCoreConfiguration.java
0 → 100644
View file @
fef76a64
/*
* 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.Qualifier
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.web.client.RestTemplateBuilder
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.scheduling.TaskScheduler
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler
;
import
org.springframework.web.client.DefaultResponseErrorHandler
;
import
de.codecentric.boot.admin.journal.ApplicationEventJournal
;
import
de.codecentric.boot.admin.journal.store.JournaledEventStore
;
import
de.codecentric.boot.admin.journal.store.SimpleJournaledEventStore
;
import
de.codecentric.boot.admin.registry.ApplicationIdGenerator
;
import
de.codecentric.boot.admin.registry.ApplicationRegistry
;
import
de.codecentric.boot.admin.registry.HashingApplicationUrlIdGenerator
;
import
de.codecentric.boot.admin.registry.StatusUpdateApplicationListener
;
import
de.codecentric.boot.admin.registry.StatusUpdater
;
import
de.codecentric.boot.admin.registry.store.ApplicationStore
;
import
de.codecentric.boot.admin.registry.store.SimpleApplicationStore
;
import
de.codecentric.boot.admin.web.client.BasicAuthHttpHeaderProvider
;
import
de.codecentric.boot.admin.web.client.HttpHeadersProvider
;
@Configuration
@EnableConfigurationProperties
(
AdminServerProperties
.
class
)
public
class
AdminServerCoreConfiguration
{
private
final
AdminServerProperties
adminServerProperties
;
public
AdminServerCoreConfiguration
(
AdminServerProperties
adminServerProperties
)
{
this
.
adminServerProperties
=
adminServerProperties
;
}
@Bean
@ConditionalOnMissingBean
public
ApplicationRegistry
applicationRegistry
(
ApplicationStore
applicationStore
,
ApplicationIdGenerator
applicationIdGenerator
)
{
return
new
ApplicationRegistry
(
applicationStore
,
applicationIdGenerator
);
}
@Bean
@ConditionalOnMissingBean
public
ApplicationIdGenerator
applicationIdGenerator
()
{
return
new
HashingApplicationUrlIdGenerator
();
}
@Bean
@ConditionalOnMissingBean
public
HttpHeadersProvider
httpHeadersProvider
()
{
return
new
BasicAuthHttpHeaderProvider
();
}
@Bean
@ConditionalOnMissingBean
public
StatusUpdater
statusUpdater
(
RestTemplateBuilder
restTemplBuilder
,
ApplicationStore
applicationStore
)
{
RestTemplateBuilder
builder
=
restTemplBuilder
.
messageConverters
(
new
MappingJackson2HttpMessageConverter
())
.
errorHandler
(
new
DefaultResponseErrorHandler
()
{
@Override
protected
boolean
hasError
(
HttpStatus
statusCode
)
{
return
false
;
}
});
StatusUpdater
statusUpdater
=
new
StatusUpdater
(
builder
.
build
(),
applicationStore
,
httpHeadersProvider
());
statusUpdater
.
setStatusLifetime
(
adminServerProperties
.
getMonitor
().
getStatusLifetime
());
return
statusUpdater
;
}
@Bean
@Qualifier
(
"updateTaskScheduler"
)
public
TaskScheduler
updateTaskScheduler
()
{
ThreadPoolTaskScheduler
taskScheduler
=
new
ThreadPoolTaskScheduler
();
taskScheduler
.
setPoolSize
(
1
);
taskScheduler
.
setRemoveOnCancelPolicy
(
true
);
taskScheduler
.
setThreadNamePrefix
(
"updateTask"
);
return
taskScheduler
;
}
@Bean
@ConditionalOnMissingBean
public
StatusUpdateApplicationListener
statusUpdateApplicationListener
(
StatusUpdater
statusUpdater
,
@Qualifier
(
"updateTaskScheduler"
)
TaskScheduler
taskScheduler
)
{
StatusUpdateApplicationListener
listener
=
new
StatusUpdateApplicationListener
(
statusUpdater
,
taskScheduler
);
listener
.
setUpdatePeriod
(
adminServerProperties
.
getMonitor
().
getPeriod
());
return
listener
;
}
@Bean
@ConditionalOnMissingBean
public
ApplicationEventJournal
applicationEventJournal
(
JournaledEventStore
journaledEventStore
)
{
return
new
ApplicationEventJournal
(
journaledEventStore
);
}
@Bean
@ConditionalOnMissingBean
public
JournaledEventStore
journaledEventStore
()
{
return
new
SimpleJournaledEventStore
();
}
@Bean
@ConditionalOnMissingBean
public
ApplicationStore
applicationStore
()
{
return
new
SimpleApplicationStore
();
}
}
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/AdminServerImportSelector.java
View file @
fef76a64
...
...
@@ -30,6 +30,7 @@ public class AdminServerImportSelector implements DeferredImportSelector {
public
String
[]
selectImports
(
AnnotationMetadata
importingClassMetadata
)
{
return
new
String
[]
{
NotifierConfiguration
.
class
.
getCanonicalName
(),
HazelcastStoreConfiguration
.
class
.
getCanonicalName
(),
AdminServerCoreConfiguration
.
class
.
getCanonicalName
(),
AdminServerWebConfiguration
.
class
.
getCanonicalName
(),
DiscoveryClientConfiguration
.
class
.
getCanonicalName
(),
RevereseZuulProxyConfiguration
.
class
.
getCanonicalName
()
};
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/AdminServerWebConfiguration.java
View file @
fef76a64
This diff is collapsed.
Click to expand it.
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/config/AdminServerWebConfigurationTest.java
View file @
fef76a64
...
...
@@ -63,7 +63,8 @@ public class AdminServerWebConfigurationTest {
@Test
public
void
jacksonMapperPresentFromDefault
()
{
AdminServerWebConfiguration
config
=
new
AdminServerWebConfiguration
();
AdminServerWebConfiguration
config
=
new
AdminServerWebConfiguration
(
null
,
null
,
null
,
null
);
List
<
HttpMessageConverter
<?>>
converters
=
new
ArrayList
<>();
converters
.
add
(
new
MappingJackson2HttpMessageConverter
());
...
...
@@ -76,7 +77,8 @@ public class AdminServerWebConfigurationTest {
@Test
public
void
jacksonMapperPresentNeedExtend
()
{
AdminServerWebConfiguration
config
=
new
AdminServerWebConfiguration
();
AdminServerWebConfiguration
config
=
new
AdminServerWebConfiguration
(
null
,
null
,
null
,
null
);
List
<
HttpMessageConverter
<?>>
converters
=
new
ArrayList
<>();
config
.
extendMessageConverters
(
converters
);
...
...
@@ -137,6 +139,7 @@ public class AdminServerWebConfigurationTest {
applicationContext
.
register
(
HazelcastAutoConfiguration
.
class
);
applicationContext
.
register
(
HazelcastStoreConfiguration
.
class
);
applicationContext
.
register
(
DiscoveryClientConfiguration
.
class
);
applicationContext
.
register
(
AdminServerCoreConfiguration
.
class
);
applicationContext
.
register
(
AdminServerWebConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
applicationContext
,
environment
);
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/config/DiscoveryClientConfigurationTest.java
View file @
fef76a64
...
...
@@ -94,6 +94,7 @@ public class DiscoveryClientConfigurationTest {
applicationContext
.
register
(
PropertyPlaceholderAutoConfiguration
.
class
);
applicationContext
.
register
(
RestTemplateConfiguration
.
class
);
applicationContext
.
register
(
ServerPropertiesAutoConfiguration
.
class
);
applicationContext
.
register
(
AdminServerCoreConfiguration
.
class
);
applicationContext
.
register
(
AdminServerWebConfiguration
.
class
);
applicationContext
.
register
(
DiscoveryClientConfiguration
.
class
);
...
...
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