Remove deprecated code

Closes gh-8891
pull/7241/merge
Stephane Nicoll 8 years ago
parent 269cea291c
commit 275bff39aa

@ -229,18 +229,6 @@ public class EndpointMBeanExporter extends MBeanExporter
* @return an adapted endpoint
*/
protected JmxEndpoint adaptEndpoint(String beanName, Endpoint<?> endpoint) {
return getEndpointMBean(beanName, endpoint);
}
/**
* Get a {@link EndpointMBean} for the specified {@link Endpoint}.
* @param beanName the bean name
* @param endpoint the endpoint
* @return an {@link EndpointMBean}
* @deprecated as of 1.5 in favor of {@link #adaptEndpoint(String, Endpoint)}
*/
@Deprecated
protected EndpointMBean getEndpointMBean(String beanName, Endpoint<?> endpoint) {
if (endpoint instanceof ShutdownEndpoint) {
return new ShutdownEndpointMBean(beanName, endpoint, this.objectMapper);
}

@ -106,6 +106,11 @@ public class AutoConfigurationImportSelector
}
protected boolean isEnabled(AnnotationMetadata metadata) {
if (getClass().equals(AutoConfigurationImportSelector.class)) {
return getEnvironment().getProperty(
EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY, Boolean.class,
true);
}
return true;
}

@ -73,7 +73,7 @@ import org.springframework.core.io.support.SpringFactoriesLoader;
@Documented
@Inherited
@AutoConfigurationPackage
@Import(EnableAutoConfigurationImportSelector.class)
@Import(AutoConfigurationImportSelector.class)
public @interface EnableAutoConfiguration {
String ENABLED_OVERRIDE_PROPERTY = "spring.boot.enableautoconfiguration";

@ -1,49 +0,0 @@
/*
* Copyright 2012-2017 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 org.springframework.context.annotation.DeferredImportSelector;
import org.springframework.core.type.AnnotationMetadata;
/**
* {@link DeferredImportSelector} to handle {@link EnableAutoConfiguration
* auto-configuration}. This class can also be subclassed if a custom variant of
* {@link EnableAutoConfiguration @EnableAutoConfiguration}. is needed.
*
* @deprecated as of 1.5 in favor of {@link AutoConfigurationImportSelector}
* @author Phillip Webb
* @author Andy Wilkinson
* @author Stephane Nicoll
* @author Madhura Bhave
* @since 1.3.0
* @see EnableAutoConfiguration
*/
@Deprecated
public class EnableAutoConfigurationImportSelector
extends AutoConfigurationImportSelector {
@Override
protected boolean isEnabled(AnnotationMetadata metadata) {
if (getClass().equals(EnableAutoConfigurationImportSelector.class)) {
return getEnvironment().getProperty(
EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY, Boolean.class,
true);
}
return true;
}
}

@ -1,54 +0,0 @@
/*
* Copyright 2012-2017 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 org.springframework.context.MessageSource;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.Ordered;
import org.springframework.core.type.AnnotationMetadata;
/**
* {@link EnableAutoConfiguration Auto-configuration} for {@link MessageSource}.
*
* @author Dave Syer
* @author Phillip Webb
* @author Eddú Meléndez
* @deprecated as of 1.5 in favor of
* {@link org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration}
*/
@Configuration
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
@Deprecated
@Import(MessageSourceAutoConfiguration.Selector.class)
public class MessageSourceAutoConfiguration {
private static final String[] REPLACEMENT = {
"org.springframework.boot.autoconfigure.context."
+ "MessageSourceAutoConfiguration" };
static class Selector implements ImportSelector {
@Override
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
return REPLACEMENT;
}
}
}

@ -1,54 +0,0 @@
/*
* Copyright 2012-2017 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 org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.Ordered;
import org.springframework.core.type.AnnotationMetadata;
/**
* {@link EnableAutoConfiguration Auto-configuration} for
* {@link PropertySourcesPlaceholderConfigurer}.
*
* @author Phillip Webb
* @author Dave Syer
* @deprecated as of 1.5 in favor of
* {@link org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration}
*/
@Configuration
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
@Deprecated
@Import(PropertyPlaceholderAutoConfiguration.Selector.class)
public class PropertyPlaceholderAutoConfiguration {
private static final String[] REPLACEMENT = {
"org.springframework.boot.autoconfigure.context."
+ "PropertyPlaceholderAutoConfiguration" };
static class Selector implements ImportSelector {
@Override
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
return REPLACEMENT;
}
}
}

@ -29,7 +29,6 @@ import java.util.Set;
import java.util.TimeZone;
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.server.Compression;
import org.springframework.boot.web.server.Ssl;
@ -1115,12 +1114,6 @@ public class ServerProperties {
*/
private Integer bufferSize;
/**
* Number of buffer per region.
*/
@Deprecated
private Integer buffersPerRegion;
/**
* Number of I/O threads to create for the worker.
*/
@ -1154,15 +1147,6 @@ public class ServerProperties {
this.bufferSize = bufferSize;
}
@DeprecatedConfigurationProperty(reason = "The property is not used by Undertow. See https://issues.jboss.org/browse/UNDERTOW-587 for details")
public Integer getBuffersPerRegion() {
return this.buffersPerRegion;
}
public void setBuffersPerRegion(Integer buffersPerRegion) {
this.buffersPerRegion = buffersPerRegion;
}
public Integer getIoThreads() {
return this.ioThreads;
}

@ -1,78 +0,0 @@
/*
* Copyright 2012-2017 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 org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.type.StandardAnnotationMetadata;
import org.springframework.mock.env.MockEnvironment;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link EnableAutoConfigurationImportSelector}
*
* @author Andy Wilkinson
* @author Stephane Nicoll
* @author Madhura Bhave
*/
@SuppressWarnings("deprecation")
public class EnableAutoConfigurationImportSelectorTests {
private final EnableAutoConfigurationImportSelector importSelector = new EnableAutoConfigurationImportSelector();
private final ConfigurableListableBeanFactory beanFactory = new DefaultListableBeanFactory();
private final MockEnvironment environment = new MockEnvironment();
@Before
public void setup() {
this.importSelector.setBeanFactory(this.beanFactory);
this.importSelector.setEnvironment(this.environment);
this.importSelector.setResourceLoader(new DefaultResourceLoader());
}
@Test
public void propertyOverrideSetToTrue() throws Exception {
this.environment.setProperty(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY,
"true");
String[] imports = selectImports(BasicEnableAutoConfiguration.class);
assertThat(imports).isNotEmpty();
}
@Test
public void propertyOverrideSetToFalse() throws Exception {
this.environment.setProperty(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY,
"false");
String[] imports = selectImports(BasicEnableAutoConfiguration.class);
assertThat(imports).isEmpty();
}
private String[] selectImports(Class<?> source) {
return this.importSelector.selectImports(new StandardAnnotationMetadata(source));
}
@EnableAutoConfiguration
private class BasicEnableAutoConfiguration {
}
}

@ -1,47 +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.context.event;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.Environment;
/**
* Event published as early as conceivably possible as soon as a {@link SpringApplication}
* has been started - before the {@link Environment} or {@link ApplicationContext} is
* available, but after the {@link ApplicationListener}s have been registered. The source
* of the event is the {@link SpringApplication} itself, but beware of using its internal
* state too much at this early stage since it might be modified later in the lifecycle.
*
* @author Dave Syer
* @deprecated as of 1.5 in favor of {@link ApplicationStartingEvent}
*/
@Deprecated
@SuppressWarnings("serial")
public class ApplicationStartedEvent extends ApplicationStartingEvent {
/**
* Create a new {@link ApplicationStartedEvent} instance.
* @param application the current application
* @param args the arguments the application is running with
*/
public ApplicationStartedEvent(SpringApplication application, String[] args) {
super(application, args);
}
}

@ -65,7 +65,7 @@ public class EventPublishingRunListener implements SpringApplicationRunListener,
@SuppressWarnings("deprecation")
public void starting() {
this.initialMulticaster
.multicastEvent(new ApplicationStartedEvent(this.application, this.args));
.multicastEvent(new ApplicationStartingEvent(this.application, this.args));
}
@Override

@ -544,18 +544,6 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
this.baseDirectory = baseDirectory;
}
/**
* A comma-separated list of jars to ignore for TLD scanning. See Tomcat's
* catalina.properties for typical values. Defaults to a list drawn from that source.
* @param tldSkip the jars to skip when scanning for TLDs etc
* @deprecated as of 1.5 in favor of {@link #setTldSkipPatterns(Collection)}
*/
@Deprecated
public void setTldSkip(String tldSkip) {
Assert.notNull(tldSkip, "TldSkip must not be null");
setTldSkipPatterns(StringUtils.commaDelimitedListToSet(tldSkip));
}
/**
* Returns a mutable set of the patterns that match jars to ignore for TLD scanning.
* @return the list of jars to ignore for TLD scanning

@ -580,11 +580,6 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac
this.bufferSize = bufferSize;
}
@Deprecated
public void setBuffersPerRegion(Integer buffersPerRegion) {
}
public void setIoThreads(Integer ioThreads) {
this.ioThreads = ioThreads;
}

@ -377,8 +377,6 @@ public class SpringApplicationTests {
application.addListeners(new ApplicationRunningEventListener());
this.context = application.run();
assertThat(events).hasSize(5);
assertThat(events.get(0)).isInstanceOf(
org.springframework.boot.context.event.ApplicationStartedEvent.class);
assertThat(events.get(0)).isInstanceOf(ApplicationStartingEvent.class);
assertThat(events.get(1)).isInstanceOf(ApplicationEnvironmentPreparedEvent.class);
assertThat(events.get(2)).isInstanceOf(ApplicationPreparedEvent.class);

Loading…
Cancel
Save