Polish
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -37,7 +38,6 @@ import org.springframework.core.type.classreading.MetadataReader;
|
||||
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
/**
|
||||
* Sort {@link EnableAutoConfiguration auto-configuration} classes into priority order by
|
||||
* reading {@link Ordered} and {@link AutoConfigureAfter} annotations (without loading
|
||||
|
||||
@@ -27,7 +27,8 @@ import org.springframework.security.authentication.AuthenticationManager;
|
||||
@Configuration
|
||||
@ConditionalOnClass(AuthenticationManager.class)
|
||||
@EnableConfigurationProperties
|
||||
@Import({ SpringBootWebSecurityConfiguration.class, AuthenticationManagerConfiguration.class })
|
||||
@Import({ SpringBootWebSecurityConfiguration.class,
|
||||
AuthenticationManagerConfiguration.class })
|
||||
public class SecurityAutoConfiguration {
|
||||
|
||||
@Bean(name = "org.springframework.autoconfigure.security.SecurityProperties")
|
||||
|
||||
@@ -65,9 +65,10 @@ public class RabbitAutoconfigurationTests {
|
||||
public void testRabbitTemplateWithOverrides() {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.register(TestConfiguration.class, RabbitAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.rabbitmq.host:remote-server",
|
||||
"spring.rabbitmq.port:9000", "spring.rabbitmq.username:alice",
|
||||
"spring.rabbitmq.password:secret", "spring.rabbitmq.virtual_host:/vhost");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.rabbitmq.host:remote-server", "spring.rabbitmq.port:9000",
|
||||
"spring.rabbitmq.username:alice", "spring.rabbitmq.password:secret",
|
||||
"spring.rabbitmq.virtual_host:/vhost");
|
||||
this.context.refresh();
|
||||
CachingConnectionFactory connectionFactory = this.context
|
||||
.getBean(CachingConnectionFactory.class);
|
||||
@@ -80,7 +81,8 @@ public class RabbitAutoconfigurationTests {
|
||||
public void testRabbitTemplateEmptyVirtualHost() {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.register(TestConfiguration.class, RabbitAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.rabbitmq.virtual_host:");
|
||||
EnvironmentTestUtils
|
||||
.addEnvironment(this.context, "spring.rabbitmq.virtual_host:");
|
||||
this.context.refresh();
|
||||
CachingConnectionFactory connectionFactory = this.context
|
||||
.getBean(CachingConnectionFactory.class);
|
||||
@@ -91,7 +93,8 @@ public class RabbitAutoconfigurationTests {
|
||||
public void testRabbitTemplateVirtualHostMissingSlash() {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.register(TestConfiguration.class, RabbitAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.rabbitmq.virtual_host:foo");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.rabbitmq.virtual_host:foo");
|
||||
this.context.refresh();
|
||||
CachingConnectionFactory connectionFactory = this.context
|
||||
.getBean(CachingConnectionFactory.class);
|
||||
@@ -102,7 +105,8 @@ public class RabbitAutoconfigurationTests {
|
||||
public void testRabbitTemplateDefaultVirtualHost() {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.register(TestConfiguration.class, RabbitAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.rabbitmq.virtual_host:/");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.rabbitmq.virtual_host:/");
|
||||
this.context.refresh();
|
||||
CachingConnectionFactory connectionFactory = this.context
|
||||
.getBean(CachingConnectionFactory.class);
|
||||
@@ -126,7 +130,8 @@ public class RabbitAutoconfigurationTests {
|
||||
public void testStaticQueues() {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.register(TestConfiguration.class, RabbitAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.rabbitmq.dynamic:false");
|
||||
EnvironmentTestUtils
|
||||
.addEnvironment(this.context, "spring.rabbitmq.dynamic:false");
|
||||
this.context.refresh();
|
||||
// There should NOT be an AmqpAdmin bean when dynamic is switch to false
|
||||
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
||||
|
||||
@@ -56,7 +56,8 @@ public class AopAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.register(TestConfiguration.class, AopAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.aop.proxyTargetClass:true");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.aop.proxyTargetClass:true");
|
||||
this.context.refresh();
|
||||
TestAspect aspect = this.context.getBean(TestAspect.class);
|
||||
assertFalse(aspect.isCalled());
|
||||
@@ -70,7 +71,8 @@ public class AopAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.register(TestConfiguration.class, AopAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.aop.proxyTargetClass:false");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.aop.proxyTargetClass:false");
|
||||
this.context.refresh();
|
||||
TestAspect aspect = this.context.getBean(TestAspect.class);
|
||||
assertFalse(aspect.isCalled());
|
||||
|
||||
@@ -56,7 +56,8 @@ public class TomcatDataSourceConfigurationTests {
|
||||
@Test
|
||||
public void testDataSourcePropertiesOverridden() throws Exception {
|
||||
this.context.register(TomcatDataSourceConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.url:jdbc:foo//bar/spam");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.datasource.url:jdbc:foo//bar/spam");
|
||||
this.context.refresh();
|
||||
assertEquals("jdbc:foo//bar/spam",
|
||||
this.context.getBean(org.apache.tomcat.jdbc.pool.DataSource.class)
|
||||
|
||||
@@ -118,7 +118,8 @@ public class JmsTemplateAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context
|
||||
.register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.jms.pubSubDomain:false");
|
||||
EnvironmentTestUtils
|
||||
.addEnvironment(this.context, "spring.jms.pubSubDomain:false");
|
||||
this.context.refresh();
|
||||
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
|
||||
ActiveMQConnectionFactory connectionFactory = this.context
|
||||
@@ -134,7 +135,8 @@ public class JmsTemplateAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context
|
||||
.register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.activemq.inMemory:false");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.activemq.inMemory:false");
|
||||
this.context.refresh();
|
||||
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
|
||||
ActiveMQConnectionFactory connectionFactory = this.context
|
||||
@@ -153,7 +155,8 @@ public class JmsTemplateAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context
|
||||
.register(TestConfiguration.class, JmsTemplateAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.activemq.inMemory:false",
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.activemq.inMemory:false",
|
||||
"spring.activemq.brokerURL:tcp://remote-host:10000");
|
||||
this.context.refresh();
|
||||
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class);
|
||||
|
||||
@@ -38,8 +38,9 @@ public class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigura
|
||||
|
||||
@Test
|
||||
public void testCustomNamingStrategy() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "spring.jpa.hibernate.namingstrategy:"
|
||||
+ "org.hibernate.cfg.EJB3NamingStrategy");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.jpa.hibernate.namingstrategy:"
|
||||
+ "org.hibernate.cfg.EJB3NamingStrategy");
|
||||
setupTestConfiguration();
|
||||
this.context.refresh();
|
||||
LocalContainerEntityManagerFactoryBean bean = this.context
|
||||
|
||||
@@ -86,8 +86,8 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
|
||||
this.context.register(Config.class, ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "server.tomcat.basedir:target/foo",
|
||||
"server.port:9000");
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"server.tomcat.basedir:target/foo", "server.port:9000");
|
||||
this.context.refresh();
|
||||
ServerProperties server = this.context.getBean(ServerProperties.class);
|
||||
assertNotNull(server);
|
||||
|
||||
Reference in New Issue
Block a user