diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java deleted file mode 100644 index a18a476df..000000000 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/ExceptionLoggingFilter.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2013-2019 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 - * - * https://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.cloud.sleuth.instrument.web; - -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @deprecated Since 2.2.3 this is disabled by default and will be removed in 3.0 - */ -@Deprecated -class ExceptionLoggingFilter implements Filter { - - private static final Log log = LogFactory.getLog(ExceptionLoggingFilter.class); - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - try { - chain.doFilter(request, response); - } - catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error("Uncaught exception thrown", ex); - } - throw ex; - } - } - - @Override - public void destroy() { - - } - -} diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java index be0a98459..04d3c236d 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/SleuthWebProperties.java @@ -56,18 +56,6 @@ class SleuthWebProperties { */ private int filterOrder = TraceHttpAutoConfiguration.TRACING_FILTER_ORDER; - /** - * Flag to toggle the presence of a filter that logs thrown exceptions. - * @deprecated use {@link #exceptionLoggingFilterEnabled} - */ - @Deprecated - private boolean exceptionThrowingFilterEnabled = true; - - /** - * Flag to toggle the presence of a filter that logs thrown exceptions. - */ - private boolean exceptionLoggingFilterEnabled = true; - /** * If set to true, auto-configured skip patterns will be ignored. * @see SkipPatternConfiguration @@ -115,23 +103,6 @@ class SleuthWebProperties { this.filterOrder = filterOrder; } - public boolean isExceptionThrowingFilterEnabled() { - return this.exceptionThrowingFilterEnabled; - } - - public void setExceptionThrowingFilterEnabled( - boolean exceptionThrowingFilterEnabled) { - this.exceptionThrowingFilterEnabled = exceptionThrowingFilterEnabled; - } - - public boolean isExceptionLoggingFilterEnabled() { - return this.exceptionLoggingFilterEnabled; - } - - public void setExceptionLoggingFilterEnabled(boolean exceptionLoggingFilterEnabled) { - this.exceptionLoggingFilterEnabled = exceptionLoggingFilterEnabled; - } - public boolean isIgnoreAutoConfiguredSkipPatterns() { return ignoreAutoConfiguredSkipPatterns; } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java index 0b33438b2..46a1dc843 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java @@ -85,19 +85,6 @@ class TraceWebServletAutoConfiguration { return filterRegistrationBean; } - @Bean - @ConditionalOnProperty("spring.sleuth.web.exception-logging-filter-enabled") - public FilterRegistrationBean exceptionThrowingFilter( - SleuthWebProperties webProperties) { - FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean( - new ExceptionLoggingFilter()); - filterRegistrationBean.setDispatcherTypes(DispatcherType.ASYNC, - DispatcherType.ERROR, DispatcherType.FORWARD, DispatcherType.INCLUDE, - DispatcherType.REQUEST); - filterRegistrationBean.setOrder(webProperties.getFilterOrder()); - return filterRegistrationBean; - } - @Bean @ConditionalOnMissingBean public TracingFilter tracingFilter(HttpTracing tracing) { diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java deleted file mode 100644 index cdc3fb913..000000000 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/NeverRetry.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2013-2019 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 - * - * https://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.cloud.sleuth.instrument.web.client.feign; - -import feign.RetryableException; -import feign.Retryer; - -/** - * This is essentially the same implementation of a Retryer that is in newer versions of - * Feign. For the 1.0.x stream we add it here. - * - * @author Ryan Baxter - * @deprecated This type will be removed in 3.0 - */ -@Deprecated -public class NeverRetry implements Retryer { - - /** - * Default retry entry. - */ - public static final NeverRetry INSTANCE = new NeverRetry(); - - @Override - public void continueOrPropagate(RetryableException e) { - throw e; - } - - @Override - public Retryer clone() { - return this; - } - -} diff --git a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocator.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocator.java index 0227a834d..066821695 100644 --- a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocator.java +++ b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocator.java @@ -40,12 +40,8 @@ import org.springframework.util.StringUtils; * You can override the name using {@link ZipkinProperties.Service#setName(String)} * * @author Dave Syer - * @since 1.0.0 - * @deprecated This type should have never been public and will be hidden or removed in - * 3.0 */ -@Deprecated -public class DefaultEndpointLocator implements EndpointLocator, +class DefaultEndpointLocator implements EndpointLocator, ApplicationListener { private static final Log log = LogFactory.getLog(DefaultEndpointLocator.class); @@ -64,9 +60,9 @@ public class DefaultEndpointLocator implements EndpointLocator, private InetAddress firstNonLoopbackAddress; - public DefaultEndpointLocator(Registration registration, - ServerProperties serverProperties, Environment environment, - ZipkinProperties zipkinProperties, InetUtils inetUtils) { + DefaultEndpointLocator(Registration registration, ServerProperties serverProperties, + Environment environment, ZipkinProperties zipkinProperties, + InetUtils inetUtils) { this.registration = registration; this.serverProperties = serverProperties; this.environment = environment; diff --git a/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java b/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java deleted file mode 100644 index a7e33aa9b..000000000 --- a/tests/spring-cloud-sleuth-instrumentation-mvc-tests/src/test/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfigurationTests.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2013-2019 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 - * - * https://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.cloud.sleuth.instrument.web; - -import org.junit.jupiter.api.Test; - -import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.test.context.runner.WebApplicationContextRunner; -import org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * @author MichaƂ Ziemba - */ -public class TraceWebServletAutoConfigurationTests { - - private static final String EXCEPTION_LOGGING_FILTER_BEAN_NAME = "exceptionThrowingFilter"; - - private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(TraceAutoConfiguration.class, - TraceHttpAutoConfiguration.class, - TraceWebServletAutoConfiguration.class)); - - @Test - public void shouldNotCreateExceptionLoggingFilterBeanByDefault() { - this.contextRunner.run((context) -> { - assertThat(context).doesNotHaveBean(EXCEPTION_LOGGING_FILTER_BEAN_NAME); - }); - } - - @Test - public void shouldCreateExceptionLoggingFilterBeanIfExplicitlyEnabled() { - this.contextRunner - .withPropertyValues( - "spring.sleuth.web.exception-logging-filter-enabled=true") - .run((context) -> { - assertThat(context).hasBean(EXCEPTION_LOGGING_FILTER_BEAN_NAME); - }); - } - - @Test - public void shouldNotCreateExceptionLoggingFilterBeanIfDisabledInProperties() { - this.contextRunner - .withPropertyValues( - "spring.sleuth.web.exception-logging-filter-enabled=false") - .run((context) -> { - assertThat(context) - .doesNotHaveBean(EXCEPTION_LOGGING_FILTER_BEAN_NAME); - }); - } - - @Test - public void shouldNotCreateExceptionLoggingFilterBeanIfDisabledInPropertiesUsingCamelCase() { - this.contextRunner - .withPropertyValues( - "spring.sleuth.web.exceptionLoggingFilterEnabled=false") - .run((context) -> { - assertThat(context) - .doesNotHaveBean(EXCEPTION_LOGGING_FILTER_BEAN_NAME); - }); - } - -}