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
08bc306a
Commit
08bc306a
authored
May 02, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Guard IntegrationJmxConfiguration if no mBeanServer is available
Closes gh-12966
parent
4585bc84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
IntegrationAutoConfiguration.java
...toconfigure/integration/IntegrationAutoConfiguration.java
+3
-1
IntegrationAutoConfigurationTests.java
...figure/integration/IntegrationAutoConfigurationTests.java
+11
-1
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java
View file @
08bc306a
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -22,6 +22,7 @@ import org.springframework.beans.BeansException;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
...
...
@@ -70,6 +71,7 @@ public class IntegrationAutoConfiguration {
@Configuration
@ConditionalOnClass
(
EnableIntegrationMBeanExport
.
class
)
@ConditionalOnMissingBean
(
value
=
IntegrationMBeanExporter
.
class
,
search
=
SearchStrategy
.
CURRENT
)
@ConditionalOnBean
(
MBeanServer
.
class
)
@ConditionalOnProperty
(
prefix
=
"spring.jmx"
,
name
=
"enabled"
,
havingValue
=
"true"
,
matchIfMissing
=
true
)
protected
static
class
IntegrationJmxConfiguration
implements
EnvironmentAware
,
BeanFactoryAware
{
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfigurationTests.java
View file @
08bc306a
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -82,6 +82,16 @@ public class IntegrationAutoConfigurationTests {
.
isEmpty
();
}
@Test
public
void
noMBeanServerAvailable
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
.
register
(
IntegrationAutoConfiguration
.
class
);
this
.
context
.
refresh
();
assertThat
(
this
.
context
.
getBean
(
TestGateway
.
class
)).
isNotNull
();
assertThat
(
this
.
context
.
getBean
(
IntegrationComponentScanAutoConfiguration
.
class
))
.
isNotNull
();
}
@Test
public
void
parentContext
()
{
load
();
...
...
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