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
16b7bf7f
Commit
16b7bf7f
authored
Feb 09, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
df088636
601c6aa3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
28 deletions
+17
-28
EndpointWebMvcAutoConfiguration.java
...ctuate/autoconfigure/EndpointWebMvcAutoConfiguration.java
+3
-12
ConditionMessage.java
...mework/boot/autoconfigure/condition/ConditionMessage.java
+2
-3
RabbitAutoConfigurationTests.java
...boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java
+4
-5
SpringApplicationTests.java
...java/org/springframework/boot/SpringApplicationTests.java
+7
-7
ConfigFileApplicationListenerTests.java
...ot/context/config/ConfigFileApplicationListenerTests.java
+1
-1
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java
View file @
16b7bf7f
...
@@ -25,8 +25,6 @@ import org.apache.commons.logging.LogFactory;
...
@@ -25,8 +25,6 @@ import org.apache.commons.logging.LogFactory;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.FatalBeanException
;
import
org.springframework.beans.FatalBeanException
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.NoSuchBeanDefinitionException
;
import
org.springframework.beans.factory.NoSuchBeanDefinitionException
;
import
org.springframework.beans.factory.SmartInitializingSingleton
;
import
org.springframework.beans.factory.SmartInitializingSingleton
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
...
@@ -101,26 +99,19 @@ import org.springframework.web.servlet.DispatcherServlet;
...
@@ -101,26 +99,19 @@ import org.springframework.web.servlet.DispatcherServlet;
RepositoryRestMvcAutoConfiguration
.
class
,
HypermediaAutoConfiguration
.
class
,
RepositoryRestMvcAutoConfiguration
.
class
,
HypermediaAutoConfiguration
.
class
,
HttpMessageConvertersAutoConfiguration
.
class
})
HttpMessageConvertersAutoConfiguration
.
class
})
public
class
EndpointWebMvcAutoConfiguration
public
class
EndpointWebMvcAutoConfiguration
implements
ApplicationContextAware
,
BeanFactoryAware
,
SmartInitializingSingleton
{
implements
ApplicationContextAware
,
SmartInitializingSingleton
{
private
static
final
Log
logger
=
LogFactory
private
static
final
Log
logger
=
LogFactory
.
getLog
(
EndpointWebMvcAutoConfiguration
.
class
);
.
getLog
(
EndpointWebMvcAutoConfiguration
.
class
);
private
ApplicationContext
applicationContext
;
private
ApplicationContext
applicationContext
;
private
BeanFactory
beanFactory
;
@Override
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
throws
BeansException
{
this
.
applicationContext
=
applicationContext
;
this
.
applicationContext
=
applicationContext
;
}
}
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
this
.
beanFactory
=
beanFactory
;
}
@Bean
@Bean
public
ManagementContextResolver
managementContextResolver
()
{
public
ManagementContextResolver
managementContextResolver
()
{
return
new
ManagementContextResolver
(
this
.
applicationContext
);
return
new
ManagementContextResolver
(
this
.
applicationContext
);
...
@@ -339,8 +330,8 @@ public class EndpointWebMvcAutoConfiguration
...
@@ -339,8 +330,8 @@ public class EndpointWebMvcAutoConfiguration
return
ConditionOutcome
return
ConditionOutcome
.
noMatch
(
message
.
because
(
"non WebApplicationContext"
));
.
noMatch
(
message
.
because
(
"non WebApplicationContext"
));
}
}
ManagementServerPort
port
=
ManagementServerPort
.
get
(
ManagementServerPort
port
=
ManagementServerPort
context
.
getEnvironment
());
.
get
(
context
.
getEnvironment
());
if
(
port
==
ManagementServerPort
.
SAME
)
{
if
(
port
==
ManagementServerPort
.
SAME
)
{
return
ConditionOutcome
.
match
(
message
.
because
(
"port is same"
));
return
ConditionOutcome
.
match
(
message
.
because
(
"port is same"
));
}
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java
View file @
16b7bf7f
...
@@ -301,9 +301,8 @@ public final class ConditionMessage {
...
@@ -301,9 +301,8 @@ public final class ConditionMessage {
if
(
StringUtils
.
isEmpty
(
reason
))
{
if
(
StringUtils
.
isEmpty
(
reason
))
{
return
new
ConditionMessage
(
ConditionMessage
.
this
,
this
.
condition
);
return
new
ConditionMessage
(
ConditionMessage
.
this
,
this
.
condition
);
}
}
return
new
ConditionMessage
(
ConditionMessage
.
this
,
return
new
ConditionMessage
(
ConditionMessage
.
this
,
this
.
condition
this
.
condition
+
(
StringUtils
.
isEmpty
(
this
.
condition
)
?
""
:
" "
)
+
(
StringUtils
.
isEmpty
(
this
.
condition
)
?
""
:
" "
)
+
reason
);
+
reason
);
}
}
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java
View file @
16b7bf7f
...
@@ -295,7 +295,7 @@ public class RabbitAutoConfigurationTests {
...
@@ -295,7 +295,7 @@ public class RabbitAutoConfigurationTests {
@Test
@Test
public
void
testRabbitListenerContainerFactoryWithCustomSettings
()
{
public
void
testRabbitListenerContainerFactoryWithCustomSettings
()
{
load
(
new
Class
<?>[]
{
MessageConvertersConfiguration
.
class
,
load
(
new
Class
<?>[]
{
MessageConvertersConfiguration
.
class
,
MessageRecoverersConfiguration
.
class
},
MessageRecoverersConfiguration
.
class
},
"spring.rabbitmq.listener.retry.enabled:true"
,
"spring.rabbitmq.listener.retry.enabled:true"
,
"spring.rabbitmq.listener.retry.maxAttempts:4"
,
"spring.rabbitmq.listener.retry.maxAttempts:4"
,
"spring.rabbitmq.listener.retry.initialInterval:2000"
,
"spring.rabbitmq.listener.retry.initialInterval:2000"
,
...
@@ -331,11 +331,11 @@ public class RabbitAutoConfigurationTests {
...
@@ -331,11 +331,11 @@ public class RabbitAutoConfigurationTests {
dfa
=
new
DirectFieldAccessor
(
adviceChain
[
0
]);
dfa
=
new
DirectFieldAccessor
(
adviceChain
[
0
]);
MessageRecoverer
messageRecoverer
=
this
.
context
.
getBean
(
"myMessageRecoverer"
,
MessageRecoverer
messageRecoverer
=
this
.
context
.
getBean
(
"myMessageRecoverer"
,
MessageRecoverer
.
class
);
MessageRecoverer
.
class
);
MethodInvocationRecoverer
mir
=
(
MethodInvocationRecoverer
)
dfa
MethodInvocationRecoverer
<?>
mir
=
(
MethodInvocationRecoverer
<?>
)
dfa
.
getPropertyValue
(
"recoverer"
);
.
getPropertyValue
(
"recoverer"
);
Message
message
=
mock
(
Message
.
class
);
Message
message
=
mock
(
Message
.
class
);
Exception
ex
=
new
Exception
(
"test"
);
Exception
ex
=
new
Exception
(
"test"
);
mir
.
recover
(
new
Object
[]
{
"foo"
,
message
},
ex
);
mir
.
recover
(
new
Object
[]
{
"foo"
,
message
},
ex
);
verify
(
messageRecoverer
).
recover
(
message
,
ex
);
verify
(
messageRecoverer
).
recover
(
message
,
ex
);
RetryTemplate
retryTemplate
=
(
RetryTemplate
)
dfa
RetryTemplate
retryTemplate
=
(
RetryTemplate
)
dfa
.
getPropertyValue
(
"retryOperations"
);
.
getPropertyValue
(
"retryOperations"
);
...
@@ -415,8 +415,7 @@ public class RabbitAutoConfigurationTests {
...
@@ -415,8 +415,7 @@ public class RabbitAutoConfigurationTests {
load
(
new
Class
<?>[]
{
config
},
environment
);
load
(
new
Class
<?>[]
{
config
},
environment
);
}
}
private
void
load
(
Class
<?>[]
configs
,
private
void
load
(
Class
<?>[]
configs
,
String
...
environment
)
{
String
...
environment
)
{
AnnotationConfigApplicationContext
applicationContext
=
new
AnnotationConfigApplicationContext
();
AnnotationConfigApplicationContext
applicationContext
=
new
AnnotationConfigApplicationContext
();
applicationContext
.
register
(
configs
);
applicationContext
.
register
(
configs
);
applicationContext
.
register
(
RabbitAutoConfiguration
.
class
);
applicationContext
.
register
(
RabbitAutoConfiguration
.
class
);
...
...
spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
View file @
16b7bf7f
...
@@ -241,7 +241,7 @@ public class SpringApplicationTests {
...
@@ -241,7 +241,7 @@ public class SpringApplicationTests {
@Test
@Test
public
void
setIgnoreBeanInfoPropertyByDefault
()
throws
Exception
{
public
void
setIgnoreBeanInfoPropertyByDefault
()
throws
Exception
{
SpringApplication
application
=
new
SpringApplication
(
ExampleConfig
.
class
);
SpringApplication
application
=
new
SpringApplication
(
ExampleConfig
.
class
);
application
.
setWeb
Environment
(
false
);
application
.
setWeb
ApplicationType
(
WebApplicationType
.
NONE
);
this
.
context
=
application
.
run
();
this
.
context
=
application
.
run
();
String
property
=
System
String
property
=
System
.
getProperty
(
CachedIntrospectionResults
.
IGNORE_BEANINFO_PROPERTY_NAME
);
.
getProperty
(
CachedIntrospectionResults
.
IGNORE_BEANINFO_PROPERTY_NAME
);
...
@@ -250,9 +250,10 @@ public class SpringApplicationTests {
...
@@ -250,9 +250,10 @@ public class SpringApplicationTests {
@Test
@Test
public
void
disableIgnoreBeanInfoProperty
()
throws
Exception
{
public
void
disableIgnoreBeanInfoProperty
()
throws
Exception
{
System
.
setProperty
(
CachedIntrospectionResults
.
IGNORE_BEANINFO_PROPERTY_NAME
,
"false"
);
System
.
setProperty
(
CachedIntrospectionResults
.
IGNORE_BEANINFO_PROPERTY_NAME
,
"false"
);
SpringApplication
application
=
new
SpringApplication
(
ExampleConfig
.
class
);
SpringApplication
application
=
new
SpringApplication
(
ExampleConfig
.
class
);
application
.
setWeb
Environment
(
false
);
application
.
setWeb
ApplicationType
(
WebApplicationType
.
NONE
);
this
.
context
=
application
.
run
();
this
.
context
=
application
.
run
();
String
property
=
System
String
property
=
System
.
getProperty
(
CachedIntrospectionResults
.
IGNORE_BEANINFO_PROPERTY_NAME
);
.
getProperty
(
CachedIntrospectionResults
.
IGNORE_BEANINFO_PROPERTY_NAME
);
...
@@ -262,7 +263,7 @@ public class SpringApplicationTests {
...
@@ -262,7 +263,7 @@ public class SpringApplicationTests {
@Test
@Test
public
void
triggersConfigFileApplicationListenerBeforeBinding
()
throws
Exception
{
public
void
triggersConfigFileApplicationListenerBeforeBinding
()
throws
Exception
{
SpringApplication
application
=
new
SpringApplication
(
ExampleConfig
.
class
);
SpringApplication
application
=
new
SpringApplication
(
ExampleConfig
.
class
);
application
.
setWeb
Environment
(
false
);
application
.
setWeb
ApplicationType
(
WebApplicationType
.
NONE
);
this
.
context
=
application
.
run
(
"--spring.config.name=bindtoapplication"
);
this
.
context
=
application
.
run
(
"--spring.config.name=bindtoapplication"
);
Field
field
=
ReflectionUtils
.
findField
(
SpringApplication
.
class
,
"bannerMode"
);
Field
field
=
ReflectionUtils
.
findField
(
SpringApplication
.
class
,
"bannerMode"
);
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
...
@@ -273,7 +274,7 @@ public class SpringApplicationTests {
...
@@ -273,7 +274,7 @@ public class SpringApplicationTests {
public
void
bindsSystemPropertyToSpringApplication
()
throws
Exception
{
public
void
bindsSystemPropertyToSpringApplication
()
throws
Exception
{
System
.
setProperty
(
"spring.main.banner-mode"
,
"off"
);
System
.
setProperty
(
"spring.main.banner-mode"
,
"off"
);
SpringApplication
application
=
new
SpringApplication
(
ExampleConfig
.
class
);
SpringApplication
application
=
new
SpringApplication
(
ExampleConfig
.
class
);
application
.
setWeb
Environment
(
false
);
application
.
setWeb
ApplicationType
(
WebApplicationType
.
NONE
);
this
.
context
=
application
.
run
();
this
.
context
=
application
.
run
();
Field
field
=
ReflectionUtils
.
findField
(
SpringApplication
.
class
,
"bannerMode"
);
Field
field
=
ReflectionUtils
.
findField
(
SpringApplication
.
class
,
"bannerMode"
);
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
...
@@ -402,8 +403,7 @@ public class SpringApplicationTests {
...
@@ -402,8 +403,7 @@ public class SpringApplicationTests {
SpringApplication
application
=
new
SpringApplication
(
ExampleWebConfig
.
class
);
SpringApplication
application
=
new
SpringApplication
(
ExampleWebConfig
.
class
);
application
.
setWebApplicationType
(
WebApplicationType
.
REACTIVE
);
application
.
setWebApplicationType
(
WebApplicationType
.
REACTIVE
);
this
.
context
=
application
.
run
();
this
.
context
=
application
.
run
();
assertThat
(
this
.
context
)
assertThat
(
this
.
context
).
isInstanceOf
(
ReactiveWebApplicationContext
.
class
);
.
isInstanceOf
(
ReactiveWebApplicationContext
.
class
);
}
}
@Test
@Test
...
...
spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java
View file @
16b7bf7f
...
@@ -809,7 +809,7 @@ public class ConfigFileApplicationListenerTests {
...
@@ -809,7 +809,7 @@ public class ConfigFileApplicationListenerTests {
@Test
@Test
public
void
profileCanBeIncludedWithoutAnyBeingActive
()
throws
Exception
{
public
void
profileCanBeIncludedWithoutAnyBeingActive
()
throws
Exception
{
SpringApplication
application
=
new
SpringApplication
(
Config
.
class
);
SpringApplication
application
=
new
SpringApplication
(
Config
.
class
);
application
.
setWeb
Environment
(
false
);
application
.
setWeb
ApplicationType
(
WebApplicationType
.
NONE
);
this
.
context
=
application
.
run
(
"--spring.profiles.include=dev"
);
this
.
context
=
application
.
run
(
"--spring.profiles.include=dev"
);
String
property
=
this
.
context
.
getEnvironment
().
getProperty
(
"my.property"
);
String
property
=
this
.
context
.
getEnvironment
().
getProperty
(
"my.property"
);
assertThat
(
property
).
isEqualTo
(
"fromdevpropertiesfile"
);
assertThat
(
property
).
isEqualTo
(
"fromdevpropertiesfile"
);
...
...
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