This commit is contained in:
Phillip Webb
2013-11-15 23:37:38 -08:00
parent 127da15c3c
commit 883fd9162f
22 changed files with 72 additions and 88 deletions

View File

@@ -197,7 +197,8 @@ public class WebMvcAutoConfiguration {
logger.info("Adding welcome page: "
+ this.resourceLoader.getResource(resource).getURL());
}
catch (IOException e) {
catch (IOException ex) {
// Ignore
}
registry.addViewController("/").setViewName("/index.html");
return;

View File

@@ -16,12 +16,15 @@
package org.springframework.boot.autoconfigure.amqp;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.TestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -29,7 +32,6 @@ import org.springframework.context.annotation.Configuration;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
/**
* Tests for {@link RabbitAutoConfiguration}.
@@ -40,6 +42,9 @@ public class RabbitAutoconfigurationTests {
private AnnotationConfigApplicationContext context;
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void testDefaultRabbitTemplate() {
this.context = new AnnotationConfigApplicationContext();
@@ -123,12 +128,11 @@ public class RabbitAutoconfigurationTests {
this.context.register(TestConfiguration.class, RabbitAutoConfiguration.class);
TestUtils.addEnviroment(this.context, "spring.rabbitmq.dynamic:false");
this.context.refresh();
try {
this.context.getBean(AmqpAdmin.class);
fail("There should NOT be an AmqpAdmin bean when dynamic is switch to false");
}
catch (Exception e) {
}
// There should NOT be an AmqpAdmin bean when dynamic is switch to false
this.thrown.expect(NoSuchBeanDefinitionException.class);
this.thrown.expectMessage("No qualifying bean of type "
+ "[org.springframework.amqp.core.AmqpAdmin] is defined");
this.context.getBean(AmqpAdmin.class);
}
@Configuration