Merge branch '1.5.x'

pull/8230/merge
Andy Wilkinson 8 years ago
commit 16b7bf7f73

@ -25,8 +25,6 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
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.SmartInitializingSingleton;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
@ -101,26 +99,19 @@ import org.springframework.web.servlet.DispatcherServlet;
RepositoryRestMvcAutoConfiguration.class, HypermediaAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class })
public class EndpointWebMvcAutoConfiguration
implements ApplicationContextAware, BeanFactoryAware, SmartInitializingSingleton {
implements ApplicationContextAware, SmartInitializingSingleton {
private static final Log logger = LogFactory
.getLog(EndpointWebMvcAutoConfiguration.class);
private ApplicationContext applicationContext;
private BeanFactory beanFactory;
@Override
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
this.applicationContext = applicationContext;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
}
@Bean
public ManagementContextResolver managementContextResolver() {
return new ManagementContextResolver(this.applicationContext);
@ -339,8 +330,8 @@ public class EndpointWebMvcAutoConfiguration
return ConditionOutcome
.noMatch(message.because("non WebApplicationContext"));
}
ManagementServerPort port = ManagementServerPort.get(
context.getEnvironment());
ManagementServerPort port = ManagementServerPort
.get(context.getEnvironment());
if (port == ManagementServerPort.SAME) {
return ConditionOutcome.match(message.because("port is same"));
}

@ -301,9 +301,8 @@ public final class ConditionMessage {
if (StringUtils.isEmpty(reason)) {
return new ConditionMessage(ConditionMessage.this, this.condition);
}
return new ConditionMessage(ConditionMessage.this,
this.condition + (StringUtils.isEmpty(this.condition) ? "" : " ")
+ reason);
return new ConditionMessage(ConditionMessage.this, this.condition
+ (StringUtils.isEmpty(this.condition) ? "" : " ") + reason);
}
}

@ -295,7 +295,7 @@ public class RabbitAutoConfigurationTests {
@Test
public void testRabbitListenerContainerFactoryWithCustomSettings() {
load(new Class<?>[] { MessageConvertersConfiguration.class,
MessageRecoverersConfiguration.class },
MessageRecoverersConfiguration.class },
"spring.rabbitmq.listener.retry.enabled:true",
"spring.rabbitmq.listener.retry.maxAttempts:4",
"spring.rabbitmq.listener.retry.initialInterval:2000",
@ -331,11 +331,11 @@ public class RabbitAutoConfigurationTests {
dfa = new DirectFieldAccessor(adviceChain[0]);
MessageRecoverer messageRecoverer = this.context.getBean("myMessageRecoverer",
MessageRecoverer.class);
MethodInvocationRecoverer mir = (MethodInvocationRecoverer) dfa
MethodInvocationRecoverer<?> mir = (MethodInvocationRecoverer<?>) dfa
.getPropertyValue("recoverer");
Message message = mock(Message.class);
Exception ex = new Exception("test");
mir.recover(new Object[]{"foo", message}, ex);
mir.recover(new Object[] { "foo", message }, ex);
verify(messageRecoverer).recover(message, ex);
RetryTemplate retryTemplate = (RetryTemplate) dfa
.getPropertyValue("retryOperations");
@ -415,8 +415,7 @@ public class RabbitAutoConfigurationTests {
load(new Class<?>[] { config }, environment);
}
private void load(Class<?>[] configs,
String... environment) {
private void load(Class<?>[] configs, String... environment) {
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
applicationContext.register(configs);
applicationContext.register(RabbitAutoConfiguration.class);

@ -241,7 +241,7 @@ public class SpringApplicationTests {
@Test
public void setIgnoreBeanInfoPropertyByDefault() throws Exception {
SpringApplication application = new SpringApplication(ExampleConfig.class);
application.setWebEnvironment(false);
application.setWebApplicationType(WebApplicationType.NONE);
this.context = application.run();
String property = System
.getProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME);
@ -250,9 +250,10 @@ public class SpringApplicationTests {
@Test
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);
application.setWebEnvironment(false);
application.setWebApplicationType(WebApplicationType.NONE);
this.context = application.run();
String property = System
.getProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME);
@ -262,7 +263,7 @@ public class SpringApplicationTests {
@Test
public void triggersConfigFileApplicationListenerBeforeBinding() throws Exception {
SpringApplication application = new SpringApplication(ExampleConfig.class);
application.setWebEnvironment(false);
application.setWebApplicationType(WebApplicationType.NONE);
this.context = application.run("--spring.config.name=bindtoapplication");
Field field = ReflectionUtils.findField(SpringApplication.class, "bannerMode");
field.setAccessible(true);
@ -273,7 +274,7 @@ public class SpringApplicationTests {
public void bindsSystemPropertyToSpringApplication() throws Exception {
System.setProperty("spring.main.banner-mode", "off");
SpringApplication application = new SpringApplication(ExampleConfig.class);
application.setWebEnvironment(false);
application.setWebApplicationType(WebApplicationType.NONE);
this.context = application.run();
Field field = ReflectionUtils.findField(SpringApplication.class, "bannerMode");
field.setAccessible(true);
@ -402,8 +403,7 @@ public class SpringApplicationTests {
SpringApplication application = new SpringApplication(ExampleWebConfig.class);
application.setWebApplicationType(WebApplicationType.REACTIVE);
this.context = application.run();
assertThat(this.context)
.isInstanceOf(ReactiveWebApplicationContext.class);
assertThat(this.context).isInstanceOf(ReactiveWebApplicationContext.class);
}
@Test

@ -809,7 +809,7 @@ public class ConfigFileApplicationListenerTests {
@Test
public void profileCanBeIncludedWithoutAnyBeingActive() throws Exception {
SpringApplication application = new SpringApplication(Config.class);
application.setWebEnvironment(false);
application.setWebApplicationType(WebApplicationType.NONE);
this.context = application.run("--spring.profiles.include=dev");
String property = this.context.getEnvironment().getProperty("my.property");
assertThat(property).isEqualTo("fromdevpropertiesfile");

Loading…
Cancel
Save