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
0a04b743
Commit
0a04b743
authored
Dec 18, 2013
by
Christian Dupuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow configuration of domainName and key for endpoint JMX export
parent
fa1ff72f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
EndpointMBeanExportAutoConfiguration.java
...e/autoconfigure/EndpointMBeanExportAutoConfiguration.java
+21
-3
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfiguration.java
View file @
0a04b743
...
@@ -16,15 +16,19 @@
...
@@ -16,15 +16,19 @@
package
org
.
springframework
.
boot
.
actuate
.
autoconfigure
;
package
org
.
springframework
.
boot
.
actuate
.
autoconfigure
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter
;
import
org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.bind.RelaxedPropertyResolver
;
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.core.env.Environment
;
import
org.springframework.jmx.export.MBeanExporter
;
import
org.springframework.jmx.export.MBeanExporter
;
import
org.springframework.util.StringUtils
;
/**
/**
* {@link EnableAutoConfiguration Auto-configuration} to enable JMX export for
* {@link EnableAutoConfiguration Auto-configuration} to enable JMX export for
...
@@ -38,10 +42,24 @@ import org.springframework.jmx.export.MBeanExporter;
...
@@ -38,10 +42,24 @@ import org.springframework.jmx.export.MBeanExporter;
@ConditionalOnExpression
(
"${endpoints.jmx.enabled:true}"
)
@ConditionalOnExpression
(
"${endpoints.jmx.enabled:true}"
)
class
EndpointMBeanExportAutoConfiguration
{
class
EndpointMBeanExportAutoConfiguration
{
private
RelaxedPropertyResolver
environment
;
@Autowired
public
void
setEnvironment
(
Environment
environment
)
{
this
.
environment
=
new
RelaxedPropertyResolver
(
environment
);
}
@Bean
@Bean
public
EndpointMBeanExporter
endpointMBeanExporter
()
{
public
EndpointMBeanExporter
endpointMBeanExporter
()
{
// TODO add configuration for domain name
EndpointMBeanExporter
mbeanExporter
=
new
EndpointMBeanExporter
();
return
new
EndpointMBeanExporter
();
String
domainName
=
this
.
environment
.
getProperty
(
"endpoints.jmx.domain_name"
);
if
(
StringUtils
.
hasText
(
domainName
))
{
mbeanExporter
.
setDomainName
(
domainName
);
}
String
key
=
this
.
environment
.
getProperty
(
"endpoints.jmx.key"
);
if
(
StringUtils
.
hasText
(
key
))
{
mbeanExporter
.
setKey
(
key
);
}
return
mbeanExporter
;
}
}
}
}
\ 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