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
17b71df2
Commit
17b71df2
authored
Jul 07, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.3.x'
parents
ccaa19d5
bbb29dd7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
IntegrationAutoConfiguration.java
...toconfigure/integration/IntegrationAutoConfiguration.java
+0
-2
IntegrationAutoConfigurationTests.java
...figure/integration/IntegrationAutoConfigurationTests.java
+32
-1
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java
View file @
17b71df2
...
@@ -33,7 +33,6 @@ import org.springframework.boot.bind.RelaxedPropertyResolver;
...
@@ -33,7 +33,6 @@ import org.springframework.boot.bind.RelaxedPropertyResolver;
import
org.springframework.context.EnvironmentAware
;
import
org.springframework.context.EnvironmentAware
;
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.context.annotation.Primary
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.env.Environment
;
import
org.springframework.integration.config.EnableIntegration
;
import
org.springframework.integration.config.EnableIntegration
;
import
org.springframework.integration.jmx.config.EnableIntegrationMBeanExport
;
import
org.springframework.integration.jmx.config.EnableIntegrationMBeanExport
;
...
@@ -87,7 +86,6 @@ public class IntegrationAutoConfiguration {
...
@@ -87,7 +86,6 @@ public class IntegrationAutoConfiguration {
}
}
@Bean
@Bean
@Primary
public
IntegrationMBeanExporter
integrationMbeanExporter
()
{
public
IntegrationMBeanExporter
integrationMbeanExporter
()
{
IntegrationMBeanExporter
exporter
=
new
IntegrationMBeanExporter
();
IntegrationMBeanExporter
exporter
=
new
IntegrationMBeanExporter
();
String
defaultDomain
=
this
.
propertyResolver
.
getProperty
(
"default-domain"
);
String
defaultDomain
=
this
.
propertyResolver
.
getProperty
(
"default-domain"
);
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfigurationTests.java
View file @
17b71df2
...
@@ -27,10 +27,15 @@ import org.junit.Test;
...
@@ -27,10 +27,15 @@ import org.junit.Test;
import
org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.integration.support.channel.HeaderChannelRegistry
;
import
org.springframework.integration.support.channel.HeaderChannelRegistry
;
import
org.springframework.jmx.export.MBeanExporter
;
import
org.springframework.test.context.support.TestPropertySourceUtils
;
import
org.springframework.test.context.support.TestPropertySourceUtils
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
/**
* Tests for {@link IntegrationAutoConfiguration}.
* Tests for {@link IntegrationAutoConfiguration}.
...
@@ -98,6 +103,14 @@ public class IntegrationAutoConfigurationTests {
...
@@ -98,6 +103,14 @@ public class IntegrationAutoConfigurationTests {
"org.springframework.integration.monitor"
);
"org.springframework.integration.monitor"
);
}
}
@Test
public
void
primaryExporterIsAllowed
()
{
load
(
CustomMBeanExporter
.
class
);
assertThat
(
this
.
context
.
getBeansOfType
(
MBeanExporter
.
class
)).
hasSize
(
2
);
assertThat
(
this
.
context
.
getBean
(
MBeanExporter
.
class
)).
isSameAs
(
this
.
context
.
getBean
(
"myMBeanExporter"
));
}
private
static
void
assertDomains
(
MBeanServer
mBeanServer
,
boolean
expected
,
private
static
void
assertDomains
(
MBeanServer
mBeanServer
,
boolean
expected
,
String
...
domains
)
{
String
...
domains
)
{
List
<
String
>
actual
=
Arrays
.
asList
(
mBeanServer
.
getDomains
());
List
<
String
>
actual
=
Arrays
.
asList
(
mBeanServer
.
getDomains
());
...
@@ -106,12 +119,30 @@ public class IntegrationAutoConfigurationTests {
...
@@ -106,12 +119,30 @@ public class IntegrationAutoConfigurationTests {
}
}
}
}
private
void
load
(
String
...
environment
)
{
public
void
load
(
String
...
environment
)
{
load
(
null
,
environment
);
}
private
void
load
(
Class
<?>
config
,
String
...
environment
)
{
AnnotationConfigApplicationContext
ctx
=
new
AnnotationConfigApplicationContext
();
AnnotationConfigApplicationContext
ctx
=
new
AnnotationConfigApplicationContext
();
if
(
config
!=
null
)
{
ctx
.
register
(
config
);
}
TestPropertySourceUtils
.
addInlinedPropertiesToEnvironment
(
ctx
,
environment
);
TestPropertySourceUtils
.
addInlinedPropertiesToEnvironment
(
ctx
,
environment
);
ctx
.
register
(
JmxAutoConfiguration
.
class
,
IntegrationAutoConfiguration
.
class
);
ctx
.
register
(
JmxAutoConfiguration
.
class
,
IntegrationAutoConfiguration
.
class
);
ctx
.
refresh
();
ctx
.
refresh
();
this
.
context
=
ctx
;
this
.
context
=
ctx
;
}
}
@Configuration
static
class
CustomMBeanExporter
{
@Bean
@Primary
public
MBeanExporter
myMBeanExporter
()
{
return
mock
(
MBeanExporter
.
class
);
}
}
}
}
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