Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
4b8d6efc
Commit
4b8d6efc
authored
Jan 09, 2021
by
bono007
Committed by
Stephane Nicoll
Jan 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for GET requests for /actuator/startup
See gh-24717
parent
8a6e79dc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
startup.adoc
...or-autoconfigure/src/docs/asciidoc/endpoints/startup.adoc
+3
-1
StartupEndpoint.java
...springframework/boot/actuate/startup/StartupEndpoint.java
+8
-0
StartupEndpointTests.java
...gframework/boot/actuate/startup/StartupEndpointTests.java
+14
-0
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/startup.adoc
View file @
4b8d6efc
...
...
@@ -16,7 +16,9 @@ The resulting response is similar to the following:
include::{snippets}/startup/http-response.adoc[]
NOTE: The above call resets the application startup steps buffer - subsequent calls to the endpoint will
not include the returned steps. To retrieve a snapshot of the steps recorded so far without removing them
from the startup buffer, make a `GET` request to `/actuator/startup`.
[[startup-retrieving-response-structure]]
=== Response Structure
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/startup/StartupEndpoint.java
View file @
4b8d6efc
...
...
@@ -18,6 +18,7 @@ package org.springframework.boot.actuate.startup;
import
org.springframework.boot.SpringBootVersion
;
import
org.springframework.boot.actuate.endpoint.annotation.Endpoint
;
import
org.springframework.boot.actuate.endpoint.annotation.ReadOperation
;
import
org.springframework.boot.actuate.endpoint.annotation.WriteOperation
;
import
org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup
;
import
org.springframework.boot.context.metrics.buffering.StartupTimeline
;
...
...
@@ -28,6 +29,7 @@ import org.springframework.boot.context.metrics.buffering.StartupTimeline;
* application startup}.
*
* @author Brian Clozel
* @author Chris Bono
* @since 2.4.0
*/
@Endpoint
(
id
=
"startup"
)
...
...
@@ -50,6 +52,12 @@ public class StartupEndpoint {
return
new
StartupResponse
(
startupTimeline
);
}
@ReadOperation
public
StartupResponse
startupSnapshot
()
{
StartupTimeline
startupTimeline
=
this
.
applicationStartup
.
getBufferedTimeline
();
return
new
StartupResponse
(
startupTimeline
);
}
/**
* A description of an application startup, primarily intended for serialization to
* JSON.
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/startup/StartupEndpointTests.java
View file @
4b8d6efc
...
...
@@ -30,6 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* Tests for {@link StartupEndpoint}.
*
* @author Brian Clozel
* @author Chris Bono
*/
class
StartupEndpointTests
{
...
...
@@ -60,6 +61,19 @@ class StartupEndpointTests {
});
}
@Test
void
bufferIsNotDrained
()
{
BufferingApplicationStartup
applicationStartup
=
new
BufferingApplicationStartup
(
256
);
ApplicationContextRunner
contextRunner
=
new
ApplicationContextRunner
()
.
withInitializer
((
context
)
->
context
.
setApplicationStartup
(
applicationStartup
))
.
withUserConfiguration
(
EndpointConfiguration
.
class
);
contextRunner
.
run
((
context
)
->
{
StartupEndpoint
.
StartupResponse
startup
=
context
.
getBean
(
StartupEndpoint
.
class
).
startupSnapshot
();
assertThat
(
startup
.
getTimeline
().
getEvents
()).
isNotEmpty
();
assertThat
(
applicationStartup
.
getBufferedTimeline
().
getEvents
()).
isNotEmpty
();
});
}
@Configuration
(
proxyBeanMethods
=
false
)
static
class
EndpointConfiguration
{
...
...
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