Remove deprecated code

This code removes code deprecated in 1.4 with the exception of code that
requires an update to Spring Framework 5.

Closes gh-6971
This commit is contained in:
Stephane Nicoll
2016-09-21 12:38:26 +02:00
parent d514cc3dab
commit ce1e41dce3
87 changed files with 31 additions and 4514 deletions

View File

@@ -29,7 +29,6 @@ import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
/**
* Configuration properties to configure Jackson.
@@ -147,17 +146,6 @@ public class JacksonProperties {
return this.generator;
}
@Deprecated
@DeprecatedConfigurationProperty(reason = "ObjectMapper.setSerializationInclusion was deprecated in Jackson 2.7", replacement = "spring.jackson.default-property-inclusion")
public JsonInclude.Include getSerializationInclusion() {
return getDefaultPropertyInclusion();
}
@Deprecated
public void setSerializationInclusion(JsonInclude.Include serializationInclusion) {
setDefaultPropertyInclusion(serializationInclusion);
}
public JsonInclude.Include getDefaultPropertyInclusion() {
return this.defaultPropertyInclusion;
}

View File

@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
/**
* Configuration properties for ActiveMQ.
@@ -74,27 +73,6 @@ public class ActiveMQProperties {
this.inMemory = inMemory;
}
/**
* Get if pooling is enabled.
* @return if pooling is enabled
* @deprecated as of 1.4 in favor of "spring.activemq.pool.enabled"
*/
@Deprecated
@DeprecatedConfigurationProperty(replacement = "spring.activemq.pool.enabled")
public boolean isPooled() {
return getPool().isEnabled();
}
/**
* Set if pooling is enabled.
* @param pooled the pooling enabled value
* @deprecated as of 1.4 in favor of "spring.activemq.pool.enabled"
*/
@Deprecated
public void setPooled(boolean pooled) {
getPool().setEnabled(pooled);
}
public String getUser() {
return this.user;
}

View File

@@ -23,7 +23,6 @@ import javax.sql.DataSource;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDatabaseConnection;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.orm.jpa.vendor.Database;
import org.springframework.util.StringUtils;
@@ -149,17 +148,6 @@ public class JpaProperties {
@NestedConfigurationProperty
private final Naming naming = new Naming();
@Deprecated
@DeprecatedConfigurationProperty(replacement = "spring.jpa.hibernate.naming.strategy")
public String getNamingStrategy() {
return getNaming().getStrategy();
}
@Deprecated
public void setNamingStrategy(String namingStrategy) {
getNaming().setStrategy(namingStrategy);
}
public String getDdlAuto() {
return this.ddlAuto;
}

View File

@@ -1,54 +0,0 @@
/*
* Copyright 2012-2016 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.test;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
/**
* Import and apply the selected auto-configuration classes for testing purposes. Applies
* the same ordering rules as {@code @EnableAutoConfiguration} but restricts the
* auto-configuration classes to the specified set, rather than consulting
* {@code spring.factories}.
*
* @author Phillip Webb
* @since 1.3.0
* @deprecated as of 1.4 in favor of
* {@link org.springframework.boot.autoconfigure.ImportAutoConfiguration}
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@org.springframework.boot.autoconfigure.ImportAutoConfiguration({})
@Deprecated
public @interface ImportAutoConfiguration {
/**
* The auto-configuration classes that should be imported.
* @return the classes to import
*/
@AliasFor(annotation = org.springframework.boot.autoconfigure.ImportAutoConfiguration.class, attribute = "value")
Class<?>[] value();
}

View File

@@ -1,21 +0,0 @@
/*
* Copyright 2012-2016 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.
*/
/**
* Test utilities related to auto-configuration.
* @deprecated as of 1.4 in favor of the {@code spring-boot-test-autoconfigure} module
*/
package org.springframework.boot.autoconfigure.test;

View File

@@ -66,7 +66,6 @@ import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletCon
import org.springframework.boot.context.embedded.undertow.UndertowBuilderCustomizer;
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.EnvironmentAware;
@@ -673,29 +672,6 @@ public class ServerProperties
this.minSpareThreads = minSpareThreads;
}
/**
* Get the max http header size.
* @return the max http header size.
* @deprecated as of 1.4 in favor of
* {@link ServerProperties#getMaxHttpHeaderSize()}
*/
@Deprecated
@DeprecatedConfigurationProperty(replacement = "server.max-http-header-size")
public int getMaxHttpHeaderSize() {
return this.maxHttpHeaderSize;
}
/**
* Set the max http header size.
* @param maxHttpHeaderSize the max http header size.
* @deprecated as of 1.4 in favor of
* {@link ServerProperties#setMaxHttpHeaderSize(int)}
*/
@Deprecated
public void setMaxHttpHeaderSize(int maxHttpHeaderSize) {
this.maxHttpHeaderSize = maxHttpHeaderSize;
}
public Accesslog getAccesslog() {
return this.accesslog;
}

View File

@@ -80,19 +80,6 @@ public class MixedMongoRepositoriesAutoConfigurationTests {
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
}
@Test
public void testMixedRepositoryConfigurationWithDeprecatedEntityScan()
throws Exception {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context,
"spring.datasource.initialize:false");
this.context.register(MixedConfigurationWithDeprecatedEntityScan.class,
BaseConfiguration.class);
this.context.refresh();
assertThat(this.context.getBean(CountryRepository.class)).isNotNull();
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
}
@Test
public void testJpaRepositoryConfigurationWithMongoTemplate() throws Exception {
this.context = new AnnotationConfigApplicationContext();
@@ -103,18 +90,6 @@ public class MixedMongoRepositoriesAutoConfigurationTests {
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
}
@Test
public void testJpaRepositoryConfigurationWithMongoTemplateAndDeprecatedEntityScan()
throws Exception {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context,
"spring.datasource.initialize:false");
this.context.register(JpaConfigurationWithDeprecatedEntityScan.class,
BaseConfiguration.class);
this.context.refresh();
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
}
@Test
public void testJpaRepositoryConfigurationWithMongoOverlap() throws Exception {
this.context = new AnnotationConfigApplicationContext();
@@ -162,25 +137,6 @@ public class MixedMongoRepositoriesAutoConfigurationTests {
}
@Configuration
@TestAutoConfigurationPackage(MongoAutoConfigurationTests.class)
@EnableMongoRepositories(basePackageClasses = Country.class)
@org.springframework.boot.orm.jpa.EntityScan(basePackageClasses = City.class)
@EnableJpaRepositories(basePackageClasses = CityRepository.class)
@SuppressWarnings("deprecation")
protected static class MixedConfigurationWithDeprecatedEntityScan {
}
@Configuration
@TestAutoConfigurationPackage(MongoAutoConfigurationTests.class)
@org.springframework.boot.orm.jpa.EntityScan(basePackageClasses = City.class)
@EnableJpaRepositories(basePackageClasses = CityRepository.class)
@SuppressWarnings("deprecation")
protected static class JpaConfigurationWithDeprecatedEntityScan {
}
// In this one the Jpa repositories and the auto-configuration packages overlap, so
// Mongo will try and configure the same repositories
@Configuration

View File

@@ -368,7 +368,7 @@ public class JacksonAutoConfigurationTests {
public void customSerializationInclusion() {
this.context.register(JacksonAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context,
"spring.jackson.serialization-inclusion:non_null");
"spring.jackson.default-property-inclusion:non_null");
this.context.refresh();
ObjectMapper objectMapper = this.context
.getBean(Jackson2ObjectMapperBuilder.class).build();

View File

@@ -54,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Eddú Meléndez
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jackson.serialization-inclusion=non_null")
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jackson.default-property-inclusion=non_null")
@DirtiesContext
public class JerseyAutoConfigurationCustomObjectMapperProviderTests {

View File

@@ -56,7 +56,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jackson.serialization-inclusion:non-null")
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.jackson.default-property-inclusion:non-null")
@DirtiesContext
public class JerseyAutoConfigurationObjectMapperProviderTests {

View File

@@ -88,7 +88,7 @@ public class HibernateJpaAutoConfigurationTests
public void testCustomNamingStrategy() throws Exception {
HibernateVersion.setRunning(HibernateVersion.V4);
EnvironmentTestUtils.addEnvironment(this.context,
"spring.jpa.hibernate.namingStrategy:"
"spring.jpa.hibernate.naming.strategy:"
+ "org.hibernate.cfg.EJB3NamingStrategy");
setupTestConfiguration();
this.context.refresh();