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
9a80b625
Commit
9a80b625
authored
Apr 05, 2018
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to Spring Boot 2.0.1
parent
db8b2a7d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
216 deletions
+25
-216
pom.xml
pom.xml
+1
-1
SpringBootAdminApplication.java
...de/codecentric/boot/admin/SpringBootAdminApplication.java
+3
-30
AdminServerUiAutoConfiguration.java
...dmin/server/ui/config/AdminServerUiAutoConfiguration.java
+9
-16
InstanceExchangeFilterFunctions.java
...in/server/web/client/InstanceExchangeFilterFunctions.java
+10
-167
AbstractAdminApplicationTest.java
...ntric/boot/admin/server/AbstractAdminApplicationTest.java
+1
-1
InstancesControllerIntegrationTest.java
.../admin/server/web/InstancesControllerIntegrationTest.java
+1
-1
No files found.
pom.xml
View file @
9a80b625
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
<url>
https://github.com/codecentric/spring-boot-admin/
</url>
<url>
https://github.com/codecentric/spring-boot-admin/
</url>
<properties>
<properties>
<revision>
2.0.0-SNAPSHOT
</revision>
<revision>
2.0.0-SNAPSHOT
</revision>
<spring-boot.version>
2.0.
0
.RELEASE
</spring-boot.version>
<spring-boot.version>
2.0.
1
.RELEASE
</spring-boot.version>
<spring-cloud.version>
Finchley.M9
</spring-cloud.version>
<spring-cloud.version>
Finchley.M9
</spring-cloud.version>
<hazelcast-tests.version>
3.9.2
</hazelcast-tests.version>
<hazelcast-tests.version>
3.9.2
</hazelcast-tests.version>
<java.version>
1.8
</java.version>
<java.version>
1.8
</java.version>
...
...
spring-boot-admin-samples/spring-boot-admin-sample-reactive/src/main/java/de/codecentric/boot/admin/SpringBootAdminApplication.java
View file @
9a80b625
...
@@ -20,15 +20,11 @@ import de.codecentric.boot.admin.server.config.AdminServerProperties;
...
@@ -20,15 +20,11 @@ import de.codecentric.boot.admin.server.config.AdminServerProperties;
import
de.codecentric.boot.admin.server.config.EnableAdminServer
;
import
de.codecentric.boot.admin.server.config.EnableAdminServer
;
import
de.codecentric.boot.admin.server.domain.entities.InstanceRepository
;
import
de.codecentric.boot.admin.server.domain.entities.InstanceRepository
;
import
de.codecentric.boot.admin.server.notify.LoggingNotifier
;
import
de.codecentric.boot.admin.server.notify.LoggingNotifier
;
import
de.codecentric.boot.admin.server.notify.RemindingNotifier
;
import
de.codecentric.boot.admin.server.notify.filter.FilteringNotifier
;
import
java.time.Duration
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.security.config.web.server.ServerHttpSecurity
;
import
org.springframework.security.config.web.server.ServerHttpSecurity
;
import
org.springframework.security.web.server.SecurityWebFilterChain
;
import
org.springframework.security.web.server.SecurityWebFilterChain
;
...
@@ -72,31 +68,8 @@ public class SpringBootAdminApplication {
...
@@ -72,31 +68,8 @@ public class SpringBootAdminApplication {
// @formatter:on
// @formatter:on
}
}
@Configuration
@Bean
public
static
class
NotifierConfig
{
public
LoggingNotifier
loggerNotifier
(
InstanceRepository
repository
)
{
private
final
InstanceRepository
repository
;
return
new
LoggingNotifier
(
repository
);
public
NotifierConfig
(
InstanceRepository
repository
)
{
this
.
repository
=
repository
;
}
@Primary
@Bean
(
initMethod
=
"start"
,
destroyMethod
=
"stop"
)
public
RemindingNotifier
remindingNotifier
()
{
RemindingNotifier
notifier
=
new
RemindingNotifier
(
filteringNotifier
(),
repository
);
notifier
.
setReminderPeriod
(
Duration
.
ofMinutes
(
10
));
notifier
.
setCheckReminderInverval
(
Duration
.
ofSeconds
(
10
));
return
notifier
;
}
@Bean
public
FilteringNotifier
filteringNotifier
()
{
return
new
FilteringNotifier
(
loggerNotifier
(),
repository
);
}
@Bean
public
LoggingNotifier
loggerNotifier
()
{
return
new
LoggingNotifier
(
repository
);
}
}
}
}
}
spring-boot-admin-server-ui/src/main/java/de/codecentric/boot/admin/server/ui/config/AdminServerUiAutoConfiguration.java
View file @
9a80b625
...
@@ -22,6 +22,7 @@ import de.codecentric.boot.admin.server.config.AdminServerWebConfiguration;
...
@@ -22,6 +22,7 @@ import de.codecentric.boot.admin.server.config.AdminServerWebConfiguration;
import
de.codecentric.boot.admin.server.ui.web.UiController
;
import
de.codecentric.boot.admin.server.ui.web.UiController
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
...
@@ -75,14 +76,10 @@ public class AdminServerUiAutoConfiguration {
...
@@ -75,14 +76,10 @@ public class AdminServerUiAutoConfiguration {
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
REACTIVE
)
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
REACTIVE
)
@Configuration
@Configuration
public
static
class
ReactiveUiConfiguration
implements
WebFluxConfigurer
{
public
static
class
ReactiveUiConfiguration
implements
WebFluxConfigurer
{
private
final
AdminServerUiProperties
uiProperties
;
@Autowired
private
final
AdminServerProperties
adminServerProperties
;
private
AdminServerUiProperties
uiProperties
;
@Autowired
public
ReactiveUiConfiguration
(
AdminServerUiProperties
uiProperties
,
private
AdminServerProperties
adminServerProperties
;
AdminServerProperties
adminServerProperties
)
{
this
.
uiProperties
=
uiProperties
;
this
.
adminServerProperties
=
adminServerProperties
;
}
@Override
@Override
public
void
addResourceHandlers
(
org
.
springframework
.
web
.
reactive
.
config
.
ResourceHandlerRegistry
registry
)
{
public
void
addResourceHandlers
(
org
.
springframework
.
web
.
reactive
.
config
.
ResourceHandlerRegistry
registry
)
{
...
@@ -95,14 +92,10 @@ public class AdminServerUiAutoConfiguration {
...
@@ -95,14 +92,10 @@ public class AdminServerUiAutoConfiguration {
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
SERVLET
)
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
SERVLET
)
@Configuration
@Configuration
public
static
class
ServletUiConfiguration
implements
WebMvcConfigurer
{
public
static
class
ServletUiConfiguration
implements
WebMvcConfigurer
{
private
final
AdminServerUiProperties
uiProperties
;
@Autowired
private
final
AdminServerProperties
adminServerProperties
;
private
AdminServerUiProperties
uiProperties
;
@Autowired
public
ServletUiConfiguration
(
AdminServerUiProperties
uiProperties
,
private
AdminServerProperties
adminServerProperties
;
AdminServerProperties
adminServerProperties
)
{
this
.
uiProperties
=
uiProperties
;
this
.
adminServerProperties
=
adminServerProperties
;
}
@Override
@Override
public
void
addResourceHandlers
(
org
.
springframework
.
web
.
servlet
.
config
.
annotation
.
ResourceHandlerRegistry
registry
)
{
public
void
addResourceHandlers
(
org
.
springframework
.
web
.
servlet
.
config
.
annotation
.
ResourceHandlerRegistry
registry
)
{
...
...
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/web/client/InstanceExchangeFilterFunctions.java
View file @
9a80b625
...
@@ -22,22 +22,11 @@ import reactor.core.publisher.Flux;
...
@@ -22,22 +22,11 @@ import reactor.core.publisher.Flux;
import
reactor.core.publisher.Mono
;
import
reactor.core.publisher.Mono
;
import
java.net.URI
;
import
java.net.URI
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.OptionalLong
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
org.springframework.core.ParameterizedTypeReference
;
import
org.springframework.core.io.buffer.DataBuffer
;
import
org.springframework.core.io.buffer.DataBuffer
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseCookie
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.client.reactive.ClientHttpResponse
;
import
org.springframework.http.client.reactive.ClientHttpResponseDecorator
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.reactive.function.BodyExtractor
;
import
org.springframework.web.reactive.function.BodyExtractors
;
import
org.springframework.web.reactive.function.client.ClientRequest
;
import
org.springframework.web.reactive.function.client.ClientRequest
;
import
org.springframework.web.reactive.function.client.ClientResponse
;
import
org.springframework.web.reactive.function.client.ClientResponse
;
import
org.springframework.web.reactive.function.client.ExchangeFilterFunction
;
import
org.springframework.web.reactive.function.client.ExchangeFilterFunction
;
...
@@ -47,7 +36,6 @@ import org.springframework.web.util.UriComponentsBuilder;
...
@@ -47,7 +36,6 @@ import org.springframework.web.util.UriComponentsBuilder;
import
static
de
.
codecentric
.
boot
.
admin
.
server
.
utils
.
MediaType
.
ACTUATOR_V1_MEDIATYPE
;
import
static
de
.
codecentric
.
boot
.
admin
.
server
.
utils
.
MediaType
.
ACTUATOR_V1_MEDIATYPE
;
import
static
de
.
codecentric
.
boot
.
admin
.
server
.
utils
.
MediaType
.
ACTUATOR_V2_MEDIATYPE
;
import
static
de
.
codecentric
.
boot
.
admin
.
server
.
utils
.
MediaType
.
ACTUATOR_V2_MEDIATYPE
;
import
static
java
.
util
.
Collections
.
emptyList
;
import
static
java
.
util
.
Collections
.
singletonList
;
import
static
java
.
util
.
Collections
.
singletonList
;
public
final
class
InstanceExchangeFilterFunctions
{
public
final
class
InstanceExchangeFilterFunctions
{
...
@@ -64,9 +52,8 @@ public final class InstanceExchangeFilterFunctions {
...
@@ -64,9 +52,8 @@ public final class InstanceExchangeFilterFunctions {
public
static
ExchangeFilterFunction
setInstance
(
Mono
<
Instance
>
instance
)
{
public
static
ExchangeFilterFunction
setInstance
(
Mono
<
Instance
>
instance
)
{
return
(
request
,
next
)
->
instance
.
map
(
return
(
request
,
next
)
->
instance
.
map
(
i
->
ClientRequest
.
from
(
request
).
attribute
(
ATTRIBUTE_INSTANCE
,
i
).
build
())
i
->
ClientRequest
.
from
(
request
).
attribute
(
ATTRIBUTE_INSTANCE
,
i
).
build
())
.
switchIfEmpty
(
request
.
url
().
isAbsolute
()
?
.
switchIfEmpty
(
request
.
url
().
isAbsolute
()
?
Mono
.
just
(
request
)
:
Mono
.
error
(
Mono
.
just
(
request
)
:
new
InstanceWebClientException
(
"Instance not found"
)))
Mono
.
error
(
new
InstanceWebClientException
(
"Instance not found"
)))
.
flatMap
(
next:
:
exchange
);
.
flatMap
(
next:
:
exchange
);
}
}
...
@@ -143,157 +130,13 @@ public final class InstanceExchangeFilterFunctions {
...
@@ -143,157 +130,13 @@ public final class InstanceExchangeFilterFunctions {
};
};
}
}
private
static
Function
<
ClientResponse
,
Mono
<
ClientResponse
>>
convertClientResponse
(
Function
<
Flux
<
DataBuffer
>,
Flux
<
DataBuffer
>>
bodConverter
,
private
static
Function
<
ClientResponse
,
Mono
<
ClientResponse
>>
convertClientResponse
(
Function
<
Flux
<
DataBuffer
>,
Flux
<
DataBuffer
>>
bodConverter
,
MediaType
contentType
)
{
MediaType
contentType
)
{
return
response
->
{
return
response
->
Mono
.
just
(
new
ConvertedBodyResponse
(
response
,
bodConverter
,
contentType
));
ClientResponse
convertedResponse
=
ClientResponse
.
from
(
response
).
headers
(
headers
->
{
}
headers
.
replace
(
HttpHeaders
.
CONTENT_TYPE
,
singletonList
(
contentType
.
toString
()));
headers
.
remove
(
HttpHeaders
.
CONTENT_LENGTH
);
private
static
class
ConvertedBodyResponse
implements
ClientResponse
{
}).
body
(
response
.
bodyToFlux
(
DataBuffer
.
class
).
transform
(
bodConverter
)).
build
();
private
final
ClientResponse
response
;
return
Mono
.
just
(
convertedResponse
);
private
final
Function
<
Flux
<
DataBuffer
>,
Flux
<
DataBuffer
>>
converter
;
};
private
final
Headers
headers
;
private
ConvertedBodyResponse
(
ClientResponse
response
,
Function
<
Flux
<
DataBuffer
>,
Flux
<
DataBuffer
>>
converter
,
MediaType
contentType
)
{
this
.
response
=
response
;
this
.
converter
=
converter
;
this
.
headers
=
new
Headers
()
{
@Override
public
OptionalLong
contentLength
()
{
return
OptionalLong
.
empty
();
}
@Override
public
Optional
<
MediaType
>
contentType
()
{
return
Optional
.
ofNullable
(
contentType
);
}
@Override
public
List
<
String
>
header
(
String
headerName
)
{
if
(
headerName
.
equals
(
HttpHeaders
.
CONTENT_TYPE
))
{
return
singletonList
(
contentType
.
toString
());
}
if
(
headerName
.
equals
(
HttpHeaders
.
CONTENT_LENGTH
))
{
return
emptyList
();
}
return
response
.
headers
().
header
(
headerName
);
}
@Override
public
HttpHeaders
asHttpHeaders
()
{
HttpHeaders
newHeaders
=
new
HttpHeaders
();
newHeaders
.
putAll
(
response
.
headers
().
asHttpHeaders
());
newHeaders
.
replace
(
HttpHeaders
.
CONTENT_TYPE
,
singletonList
(
contentType
.
toString
()));
newHeaders
.
remove
(
HttpHeaders
.
CONTENT_LENGTH
);
return
HttpHeaders
.
readOnlyHttpHeaders
(
newHeaders
);
}
};
}
@Override
public
HttpStatus
statusCode
()
{
return
response
.
statusCode
();
}
@Override
public
Headers
headers
()
{
return
headers
;
}
@Override
public
MultiValueMap
<
String
,
ResponseCookie
>
cookies
()
{
return
response
.
cookies
();
}
@Override
public
<
T
>
T
body
(
BodyExtractor
<
T
,
?
super
ClientHttpResponse
>
extractor
)
{
return
response
.
body
((
inputMessage
,
context
)
->
{
ClientHttpResponse
convertedMessage
=
new
ClientHttpResponseDecorator
(
inputMessage
)
{
@Override
public
Flux
<
DataBuffer
>
getBody
()
{
return
super
.
getBody
().
transform
(
ConvertedBodyResponse
.
this
.
converter
);
}
};
return
extractor
.
extract
(
convertedMessage
,
context
);
});
}
@Override
public
<
T
>
Mono
<
T
>
bodyToMono
(
Class
<?
extends
T
>
elementClass
)
{
if
(
Void
.
class
.
isAssignableFrom
(
elementClass
))
{
return
response
.
bodyToMono
(
elementClass
);
}
else
{
return
body
(
BodyExtractors
.
toMono
(
elementClass
));
}
}
@Override
public
<
T
>
Mono
<
T
>
bodyToMono
(
ParameterizedTypeReference
<
T
>
typeReference
)
{
if
(
Void
.
class
.
isAssignableFrom
(
typeReference
.
getType
().
getClass
()))
{
return
response
.
bodyToMono
(
typeReference
);
}
else
{
return
body
(
BodyExtractors
.
toMono
(
typeReference
));
}
}
@Override
public
<
T
>
Flux
<
T
>
bodyToFlux
(
Class
<?
extends
T
>
elementClass
)
{
if
(
Void
.
class
.
isAssignableFrom
(
elementClass
))
{
return
response
.
bodyToFlux
(
elementClass
);
}
else
{
return
body
(
BodyExtractors
.
toFlux
(
elementClass
));
}
}
@Override
public
<
T
>
Flux
<
T
>
bodyToFlux
(
ParameterizedTypeReference
<
T
>
typeReference
)
{
if
(
Void
.
class
.
isAssignableFrom
(
typeReference
.
getType
().
getClass
()))
{
return
response
.
bodyToFlux
(
typeReference
);
}
else
{
return
body
(
BodyExtractors
.
toFlux
(
typeReference
));
}
}
@Override
public
<
T
>
Mono
<
ResponseEntity
<
T
>>
toEntity
(
Class
<
T
>
bodyType
)
{
if
(
Void
.
class
.
isAssignableFrom
(
bodyType
))
{
return
response
.
toEntity
(
bodyType
);
}
else
{
return
toEntityInternal
(
bodyToMono
(
bodyType
));
}
}
@Override
public
<
T
>
Mono
<
ResponseEntity
<
T
>>
toEntity
(
ParameterizedTypeReference
<
T
>
typeReference
)
{
if
(
Void
.
class
.
isAssignableFrom
(
typeReference
.
getType
().
getClass
()))
{
return
response
.
toEntity
(
typeReference
);
}
else
{
return
toEntityInternal
(
bodyToMono
(
typeReference
));
}
}
private
<
T
>
Mono
<
ResponseEntity
<
T
>>
toEntityInternal
(
Mono
<
T
>
bodyMono
)
{
HttpHeaders
headers
=
headers
().
asHttpHeaders
();
HttpStatus
statusCode
=
statusCode
();
return
bodyMono
.
map
(
body
->
new
ResponseEntity
<>(
body
,
headers
,
statusCode
))
.
switchIfEmpty
(
Mono
.
defer
(()
->
Mono
.
just
(
new
ResponseEntity
<>(
headers
,
statusCode
))));
}
@Override
public
<
T
>
Mono
<
ResponseEntity
<
List
<
T
>>>
toEntityList
(
Class
<
T
>
responseType
)
{
return
toEntityListInternal
(
bodyToFlux
(
responseType
));
}
@Override
public
<
T
>
Mono
<
ResponseEntity
<
List
<
T
>>>
toEntityList
(
ParameterizedTypeReference
<
T
>
typeReference
)
{
return
toEntityListInternal
(
bodyToFlux
(
typeReference
));
}
private
<
T
>
Mono
<
ResponseEntity
<
List
<
T
>>>
toEntityListInternal
(
Flux
<
T
>
bodyFlux
)
{
HttpHeaders
headers
=
headers
().
asHttpHeaders
();
HttpStatus
statusCode
=
statusCode
();
return
bodyFlux
.
collectList
().
map
(
body
->
new
ResponseEntity
<>(
body
,
headers
,
statusCode
));
}
}
}
}
}
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/AbstractAdminApplicationTest.java
View file @
9a80b625
...
@@ -76,7 +76,7 @@ public abstract class AbstractAdminApplicationTest {
...
@@ -76,7 +76,7 @@ public abstract class AbstractAdminApplicationTest {
return
webClient
.
get
().
uri
(
"/instances/events"
).
accept
(
MediaType
.
TEXT_EVENT_STREAM
)
return
webClient
.
get
().
uri
(
"/instances/events"
).
accept
(
MediaType
.
TEXT_EVENT_STREAM
)
.
exchange
()
.
exchange
()
.
expectStatus
().
isOk
()
.
expectStatus
().
isOk
()
.
expectHeader
().
contentType
(
MediaType
.
TEXT_EVENT_STREAM
)
.
expectHeader
().
contentType
CompatibleWith
(
MediaType
.
TEXT_EVENT_STREAM
)
.
returnResult
(
JSONObject
.
class
).
getResponseBody
();
.
returnResult
(
JSONObject
.
class
).
getResponseBody
();
//@formatter:on
//@formatter:on
}
}
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/web/InstancesControllerIntegrationTest.java
View file @
9a80b625
...
@@ -255,7 +255,7 @@ public class InstancesControllerIntegrationTest {
...
@@ -255,7 +255,7 @@ public class InstancesControllerIntegrationTest {
return
this
.
client
.
get
().
uri
(
"/instances/events"
).
accept
(
MediaType
.
TEXT_EVENT_STREAM
)
return
this
.
client
.
get
().
uri
(
"/instances/events"
).
accept
(
MediaType
.
TEXT_EVENT_STREAM
)
.
exchange
()
.
exchange
()
.
expectStatus
().
isOk
()
.
expectStatus
().
isOk
()
.
expectHeader
().
contentType
(
MediaType
.
TEXT_EVENT_STREAM
)
.
expectHeader
().
contentType
CompatibleWith
(
MediaType
.
TEXT_EVENT_STREAM
)
.
returnResult
(
RESPONSE_TYPE
).
getResponseBody
();
.
returnResult
(
RESPONSE_TYPE
).
getResponseBody
();
//@formatter:on
//@formatter:on
}
}
...
...
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