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
fcdc4146
Commit
fcdc4146
authored
Mar 14, 2019
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove use of `@Autowired` for configuration properties bean
See gh-8762
parent
c4b8328a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
15 deletions
+19
-15
DefaultEndpointObjectNameFactory.java
...figure/endpoint/jmx/DefaultEndpointObjectNameFactory.java
+12
-1
JmxEndpointProperties.java
...ate/autoconfigure/endpoint/jmx/JmxEndpointProperties.java
+1
-12
additional-spring-configuration-metadata.json
...es/META-INF/additional-spring-configuration-metadata.json
+4
-0
SessionProperties.java
...amework/boot/autoconfigure/session/SessionProperties.java
+2
-2
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/jmx/DefaultEndpointObjectNameFactory.java
View file @
fcdc4146
...
...
@@ -37,6 +37,8 @@ class DefaultEndpointObjectNameFactory implements EndpointObjectNameFactory {
private
final
JmxEndpointProperties
properties
;
private
final
Environment
environment
;
private
final
MBeanServer
mBeanServer
;
private
final
String
contextId
;
...
...
@@ -46,6 +48,7 @@ class DefaultEndpointObjectNameFactory implements EndpointObjectNameFactory {
DefaultEndpointObjectNameFactory
(
JmxEndpointProperties
properties
,
Environment
environment
,
MBeanServer
mBeanServer
,
String
contextId
)
{
this
.
properties
=
properties
;
this
.
environment
=
environment
;
this
.
mBeanServer
=
mBeanServer
;
this
.
contextId
=
contextId
;
this
.
uniqueNames
=
environment
.
getProperty
(
"spring.jmx.unique-names"
,
...
...
@@ -55,7 +58,7 @@ class DefaultEndpointObjectNameFactory implements EndpointObjectNameFactory {
@Override
public
ObjectName
getObjectName
(
ExposableJmxEndpoint
endpoint
)
throws
MalformedObjectNameException
{
StringBuilder
builder
=
new
StringBuilder
(
this
.
properties
.
get
Domain
());
StringBuilder
builder
=
new
StringBuilder
(
determine
Domain
());
builder
.
append
(
":type=Endpoint"
);
builder
.
append
(
",name="
)
.
append
(
StringUtils
.
capitalize
(
endpoint
.
getEndpointId
().
toString
()));
...
...
@@ -71,6 +74,14 @@ class DefaultEndpointObjectNameFactory implements EndpointObjectNameFactory {
return
ObjectNameManager
.
getInstance
(
builder
.
toString
());
}
private
String
determineDomain
()
{
if
(
StringUtils
.
hasText
(
this
.
properties
.
getDomain
()))
{
return
this
.
properties
.
getDomain
();
}
return
this
.
environment
.
getProperty
(
"spring.jmx.default-domain"
,
"org.springframework.boot"
);
}
private
boolean
hasMBean
(
String
baseObjectName
)
throws
MalformedObjectNameException
{
ObjectName
query
=
new
ObjectName
(
baseObjectName
+
",*"
);
return
!
this
.
mBeanServer
.
queryNames
(
query
,
null
).
isEmpty
();
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/jmx/JmxEndpointProperties.java
View file @
fcdc4146
...
...
@@ -20,10 +20,7 @@ import java.util.LinkedHashSet;
import
java.util.Properties
;
import
java.util.Set
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.core.env.Environment
;
import
org.springframework.util.StringUtils
;
/**
* Configuration properties for JMX export of endpoints.
...
...
@@ -39,7 +36,7 @@ public class JmxEndpointProperties {
/**
* Endpoints JMX domain name. Fallback to 'spring.jmx.default-domain' if set.
*/
private
String
domain
=
"org.springframework.boot"
;
private
String
domain
;
/**
* Additional static properties to append to all ObjectNames of MBeans representing
...
...
@@ -47,14 +44,6 @@ public class JmxEndpointProperties {
*/
private
final
Properties
staticNames
=
new
Properties
();
@Autowired
public
JmxEndpointProperties
(
Environment
environment
)
{
String
defaultDomain
=
environment
.
getProperty
(
"spring.jmx.default-domain"
);
if
(
StringUtils
.
hasText
(
defaultDomain
))
{
this
.
domain
=
defaultDomain
;
}
}
public
Exposure
getExposure
()
{
return
this
.
exposure
;
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
View file @
fcdc4146
...
...
@@ -33,6 +33,10 @@
"type"
:
"java.lang.Boolean"
,
"description"
:
"Whether to enable or disable all endpoints by default."
},
{
"name"
:
"management.endpoints.jmx.domain"
,
"defaultValue"
:
"org.springframework.boot"
},
{
"name"
:
"management.endpoints.jmx.exposure.include"
,
"defaultValue"
:
"*"
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionProperties.java
View file @
fcdc4146
...
...
@@ -57,10 +57,10 @@ public class SessionProperties {
private
Servlet
servlet
=
new
Servlet
();
private
final
ServerProperties
serverProperties
;
private
ServerProperties
serverProperties
;
@Autowired
public
Session
Properties
(
ObjectProvider
<
ServerProperties
>
serverProperties
)
{
void
setServer
Properties
(
ObjectProvider
<
ServerProperties
>
serverProperties
)
{
this
.
serverProperties
=
serverProperties
.
getIfUnique
();
}
...
...
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