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
99d6af6c
Commit
99d6af6c
authored
Mar 20, 2014
by
Christian Dupuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly serialise output of endpoint command
parent
b7607222
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
endpoint.groovy
...r-shell/src/main/resources/commands/crash/endpoint.groovy
+15
-6
No files found.
spring-boot-starters/spring-boot-starter-shell/src/main/resources/commands/crash/endpoint.groovy
View file @
99d6af6c
package
commands
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.endpoint.Endpoint
import
org.springframework.boot.actuate.endpoint.jmx.*
@Usage
(
"Invoke actuator endpoints"
)
class
endpoint
{
...
...
@@ -8,7 +9,7 @@ class endpoint {
@Usage
(
"List all available and enabled actuator endpoints"
)
@Command
def
list
(
InvocationContext
context
)
{
context
.
attributes
[
'spring.beanfactory'
].
getBeansOfType
(
Endpoint
.
class
).
each
{
name
,
endpoint
->
if
(
endpoint
.
isEnabled
())
{
out
.
println
name
...
...
@@ -20,14 +21,22 @@ class endpoint {
@Usage
(
"Invoke provided actuator endpoint"
)
@Command
def
invoke
(
InvocationContext
context
,
@Usage
(
"The object name pattern"
)
@Required
@Argument
String
name
)
{
context
.
attributes
[
'spring.beanfactory'
].
getBeansOfType
(
Endpoint
.
class
).
each
{
n
,
endpoint
->
if
(
n
.
equals
(
name
)
&&
endpoint
.
isEnabled
())
{
out
.
println
endpoint
.
invoke
()
EndpointMBean
mbean
=
context
.
attributes
[
'spring.beanfactory'
].
getBean
(
EndpointMBeanExporter
.
class
).
getEndpointMBean
(
name
,
endpoint
)
if
(
mbean
instanceof
DataEndpointMBean
)
{
out
.
println
mbean
.
getData
()
}
else
{
out
.
println
mbean
.
invoke
()
}
}
}
""
}
}
\ No newline at end of file
}
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