Merge branch 'spring-framework-4.2'
This commit is contained in:
commit
16d61f849c
|
@ -28,7 +28,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
|
||||
|
@ -142,7 +141,7 @@ class AutoConfigurationSorter {
|
|||
|
||||
public int getOrder() {
|
||||
Map<String, Object> orderedAnnotation = this.metadata
|
||||
.getAnnotationAttributes(Order.class.getName());
|
||||
.getAnnotationAttributes(AutoConfigureOrder.class.getName());
|
||||
return (orderedAnnotation == null ? Ordered.LOWEST_PRECEDENCE
|
||||
: (Integer) orderedAnnotation.get("value"));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
/**
|
||||
* Auto-configuration specific variant of Spring Framework's {@link Order} annotation.
|
||||
* Allows auto-configuration classes to be ordered among themselves without affecting the
|
||||
* order of configuration classes passed to
|
||||
* {@link AnnotationConfigApplicationContext#register(Class...)}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD })
|
||||
public @interface AutoConfigureOrder {
|
||||
|
||||
/**
|
||||
* The order value. Default is {@link Ordered#LOWEST_PRECEDENCE}.
|
||||
* @see Ordered#getOrder()
|
||||
*/
|
||||
int value() default Ordered.LOWEST_PRECEDENCE;
|
||||
|
||||
}
|
|
@ -33,7 +33,6 @@ import org.springframework.context.annotation.Conditional;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.ResourceBundleMessageSource;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
|
@ -51,7 +50,7 @@ import static org.springframework.util.StringUtils.trimAllWhitespace;
|
|||
*/
|
||||
@Configuration
|
||||
@ConditionalOnMissingBean(MessageSource.class)
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||
@Conditional(ResourceBundleCondition.class)
|
||||
@EnableConfigurationProperties
|
||||
@ConfigurationProperties(prefix = "spring.messages")
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for
|
||||
|
@ -32,7 +31,7 @@ import org.springframework.core.annotation.Order;
|
|||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||
public class PropertyPlaceholderAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.cloud;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -28,7 +29,6 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Spring Cloud.
|
||||
|
@ -47,7 +47,7 @@ import org.springframework.core.annotation.Order;
|
|||
*/
|
||||
@Configuration
|
||||
@Profile("cloud")
|
||||
@Order(CloudAutoConfiguration.ORDER)
|
||||
@AutoConfigureOrder(CloudAutoConfiguration.ORDER)
|
||||
@ConditionalOnClass(CloudScanConfiguration.class)
|
||||
@ConditionalOnMissingBean(Cloud.class)
|
||||
@ConditionalOnProperty(prefix = "spring.cloud", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.glassfish.jersey.servlet.ServletProperties;
|
|||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
@ -48,7 +49,6 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.WebApplicationInitializer;
|
||||
import org.springframework.web.filter.RequestContextFilter;
|
||||
|
||||
|
@ -64,7 +64,7 @@ import org.springframework.web.filter.RequestContextFilter;
|
|||
"javax.servlet.ServletRegistration" })
|
||||
@ConditionalOnBean(type = "org.glassfish.jersey.server.ResourceConfig")
|
||||
@ConditionalOnWebApplication
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||
@AutoConfigureBefore(DispatcherServletAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(JerseyProperties.class)
|
||||
public class JerseyAutoConfiguration implements WebApplicationInitializer {
|
||||
|
|
|
@ -25,6 +25,7 @@ import javax.servlet.ServletRegistration;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
@ -53,7 +54,7 @@ import org.springframework.web.servlet.DispatcherServlet;
|
|||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication
|
||||
@ConditionalOnClass(DispatcherServlet.class)
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.springframework.beans.factory.BeanFactoryAware;
|
|||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -45,7 +46,6 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.xnio.SslClientAuthMode;
|
||||
|
@ -57,7 +57,7 @@ import org.xnio.SslClientAuthMode;
|
|||
* @author Dave Syer
|
||||
* @author Ivan Sopov
|
||||
*/
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication
|
||||
@Import(EmbeddedServletContainerCustomizerBeanPostProcessorRegistrar.class)
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.springframework.beans.factory.ListableBeanFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
@ -45,7 +46,6 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.converter.GenericConverter;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
@ -92,7 +92,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
|||
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class,
|
||||
WebMvcConfigurerAdapter.class })
|
||||
@ConditionalOnMissingBean(WebMvcConfigurationSupport.class)
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE + 10)
|
||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE + 10)
|
||||
@AutoConfigureAfter(DispatcherServletAutoConfiguration.class)
|
||||
public class WebMvcAutoConfiguration {
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.junit.Rule;
|
|||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
@ -157,11 +156,11 @@ public class AutoConfigurationSorterTests {
|
|||
|
||||
}
|
||||
|
||||
@Order(Ordered.LOWEST_PRECEDENCE)
|
||||
@AutoConfigureOrder(Ordered.LOWEST_PRECEDENCE)
|
||||
public static class OrderLowest {
|
||||
}
|
||||
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||
public static class OrderHighest {
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import javax.persistence.EntityManagerFactory;
|
|||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
@ -84,6 +85,7 @@ public class BatchAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Due to the removal of ParameterizedRowMapper, Spring Batch is incompatible with Spring Framework 4.2")
|
||||
public void testDefaultContext() throws Exception {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.register(TestConfiguration.class,
|
||||
|
@ -120,6 +122,7 @@ public class BatchAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Due to the removal of ParameterizedRowMapper, Spring Batch is incompatible with Spring Framework 4.2")
|
||||
public void testDefinesAndLaunchesJob() throws Exception {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
this.context.register(JobConfiguration.class,
|
||||
|
@ -133,6 +136,7 @@ public class BatchAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Due to the removal of ParameterizedRowMapper, Spring Batch is incompatible with Spring Framework 4.2")
|
||||
public void testDefinesAndLaunchesNamedJob() throws Exception {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
|
@ -149,6 +153,7 @@ public class BatchAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Due to the removal of ParameterizedRowMapper, Spring Batch is incompatible with Spring Framework 4.2")
|
||||
public void testDefinesAndLaunchesLocalJob() throws Exception {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
|
@ -164,6 +169,7 @@ public class BatchAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Due to the removal of ParameterizedRowMapper, Spring Batch is incompatible with Spring Framework 4.2")
|
||||
public void testDisableLaunchesJob() throws Exception {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
|
@ -177,6 +183,7 @@ public class BatchAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Due to the removal of ParameterizedRowMapper, Spring Batch is incompatible with Spring Framework 4.2")
|
||||
public void testDisableSchemaLoader() throws Exception {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
|
@ -193,6 +200,7 @@ public class BatchAutoConfigurationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Due to the removal of ParameterizedRowMapper, Spring Batch is incompatible with Spring Framework 4.2")
|
||||
public void testUsingJpa() throws Exception {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
// The order is very important here: DataSource -> Hibernate -> Batch
|
||||
|
|
|
@ -63,6 +63,7 @@ public class SampleIntegrationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Due to the removal of ParameterizedRowMapper, Spring Batch is incompatible with Spring Framework 4.2")
|
||||
public void jobSample() throws Exception {
|
||||
String output = this.cli.run("job.groovy", "foo=bar");
|
||||
assertTrue("Wrong output: " + output,
|
||||
|
@ -81,6 +82,7 @@ public class SampleIntegrationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Spring Batch is incompatible with Spring Framework 4.2")
|
||||
public void jobWebSample() throws Exception {
|
||||
String output = this.cli.run("job.groovy", "web.groovy", "foo=bar");
|
||||
assertTrue("Wrong output: " + output,
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
<snakeyaml.version>1.14</snakeyaml.version>
|
||||
<solr.version>4.7.2</solr.version>
|
||||
<spock.version>0.7-groovy-2.0</spock.version>
|
||||
<spring.version>4.1.6.BUILD-SNAPSHOT</spring.version>
|
||||
<spring.version>4.2.0.BUILD-SNAPSHOT</spring.version>
|
||||
<spring-amqp.version>1.4.3.RELEASE</spring-amqp.version>
|
||||
<spring-cloud-connectors.version>1.1.1.RELEASE</spring-cloud-connectors.version>
|
||||
<spring-batch.version>3.0.3.RELEASE</spring-batch.version>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package sample.batch;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
@ -24,6 +25,7 @@ import org.springframework.boot.test.OutputCapture;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@Ignore("Due to the removal of ParameterizedRowMapper, Spring Batch is incompatible with Spring Framework 4.2")
|
||||
public class SampleBatchApplicationTests {
|
||||
|
||||
@Rule
|
||||
|
|
Loading…
Reference in New Issue