diff --git a/build.gradle b/build.gradle index ff77a4b9829..36449aaf58b 100644 --- a/build.gradle +++ b/build.gradle @@ -112,41 +112,38 @@ configure(allprojects) { project -> dependency "org.quartz-scheduler:quartz:2.3.2" dependency "org.ehcache:jcache:1.0.1" dependency "org.ehcache:ehcache:3.4.0" - dependency "org.hibernate:hibernate-core-jakarta:5.6.1.Final" + dependency "org.hibernate:hibernate-core-jakarta:5.6.2.Final" dependency "org.hibernate:hibernate-validator:7.0.1.Final" dependency "org.webjars:webjars-locator-core:0.48" dependency "org.webjars:underscorejs:1.8.3" - dependencySet(group: 'org.apache.tomcat', version: '10.0.13') { + dependencySet(group: 'org.apache.tomcat', version: '10.0.14') { entry 'tomcat-util' entry('tomcat-websocket') { exclude group: "org.apache.tomcat", name: "tomcat-servlet-api" exclude group: "org.apache.tomcat", name: "tomcat-websocket-api" } } - dependencySet(group: 'org.apache.tomcat.embed', version: '10.0.13') { + dependencySet(group: 'org.apache.tomcat.embed', version: '10.0.14') { entry 'tomcat-embed-core' entry 'tomcat-embed-websocket' } - dependencySet(group: 'io.undertow', version: '2.2.13.Final') { + dependencySet(group: 'io.undertow', version: '2.2.14.Final') { entry 'undertow-core' - entry 'undertow-servlet-jakartaee9' - entry 'undertow-websockets-jsr-jakartaee9' + entry 'undertow-servlet-jakarta' + entry 'undertow-websockets-jsr-jakarta' } - dependencySet(group: 'com.squareup.okhttp3', version: '3.14.9') { - entry 'okhttp' - entry 'mockwebserver' - } + dependency "org.eclipse.jetty:jetty-reactive-httpclient:3.0.4" + dependency 'org.apache.httpcomponents.client5:httpclient5:5.1.2' + dependency 'org.apache.httpcomponents.core5:httpcore5-reactive:5.1.2' dependency("org.apache.httpcomponents:httpclient:4.5.13") { exclude group: "commons-logging", name: "commons-logging" } - dependency("org.apache.httpcomponents:httpasyncclient:4.1.4") { - exclude group: "commons-logging", name: "commons-logging" + dependencySet(group: 'com.squareup.okhttp3', version: '3.14.9') { + entry 'okhttp' + entry 'mockwebserver' } - dependency 'org.apache.httpcomponents.client5:httpclient5:5.1' - dependency 'org.apache.httpcomponents.core5:httpcore5-reactive:5.1.1' - dependency "org.eclipse.jetty:jetty-reactive-httpclient:3.0.4" dependency "org.jruby:jruby:9.3.2.0" dependency "org.python:jython-standalone:2.7.1" @@ -180,7 +177,7 @@ configure(allprojects) { project -> exclude group: "org.hamcrest", name: "hamcrest-core" } } - dependencySet(group: 'org.mockito', version: '4.0.0') { + dependencySet(group: 'org.mockito', version: '4.1.0') { entry('mockito-core') { exclude group: "org.hamcrest", name: "hamcrest-core" } @@ -201,7 +198,6 @@ configure(allprojects) { project -> dependency "org.skyscreamer:jsonassert:1.5.0" dependency "com.jayway.jsonpath:json-path:2.6.0" dependency "org.bouncycastle:bcpkix-jdk15on:1.66" - dependency "com.jamonapi:jamon:2.82" dependency "javax.cache:cache-api:1.1.1" dependency "javax.money:money-api:1.1" diff --git a/spring-aop/spring-aop.gradle b/spring-aop/spring-aop.gradle index 67bf95e8dd6..f87eceff6a8 100644 --- a/spring-aop/spring-aop.gradle +++ b/spring-aop/spring-aop.gradle @@ -5,7 +5,6 @@ dependencies { api(project(":spring-core")) optional("org.aspectj:aspectjweaver") optional("org.apache.commons:commons-pool2") - optional("com.jamonapi:jamon") testImplementation(testFixtures(project(":spring-beans"))) testImplementation(testFixtures(project(":spring-core"))) testFixturesImplementation(testFixtures(project(":spring-beans"))) diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java deleted file mode 100644 index 0476a4f3c7a..00000000000 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2002-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 - * - * 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.aop.interceptor; - -import com.jamonapi.MonKey; -import com.jamonapi.MonKeyImp; -import com.jamonapi.Monitor; -import com.jamonapi.MonitorFactory; -import com.jamonapi.utils.Misc; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.logging.Log; - -/** - * Performance monitor interceptor that uses JAMon library to perform the - * performance measurement on the intercepted method and output the stats. - * In addition, it tracks/counts exceptions thrown by the intercepted method. - * The stack traces can be viewed in the JAMon web application. - * - *
This code is inspired by Thierry Templier's blog. - * - * @author Dmitriy Kopylenko - * @author Juergen Hoeller - * @author Rob Harrop - * @author Steve Souza - * @since 1.1.3 - * @see com.jamonapi.MonitorFactory - * @see PerformanceMonitorInterceptor - */ -@SuppressWarnings("serial") -public class JamonPerformanceMonitorInterceptor extends AbstractMonitoringInterceptor { - - private boolean trackAllInvocations = false; - - - /** - * Create a new JamonPerformanceMonitorInterceptor with a static logger. - */ - public JamonPerformanceMonitorInterceptor() { - } - - /** - * Create a new JamonPerformanceMonitorInterceptor with a dynamic or static logger, - * according to the given flag. - * @param useDynamicLogger whether to use a dynamic logger or a static logger - * @see #setUseDynamicLogger - */ - public JamonPerformanceMonitorInterceptor(boolean useDynamicLogger) { - setUseDynamicLogger(useDynamicLogger); - } - - /** - * Create a new JamonPerformanceMonitorInterceptor with a dynamic or static logger, - * according to the given flag. - * @param useDynamicLogger whether to use a dynamic logger or a static logger - * @param trackAllInvocations whether to track all invocations that go through - * this interceptor, or just invocations with trace logging enabled - * @see #setUseDynamicLogger - */ - public JamonPerformanceMonitorInterceptor(boolean useDynamicLogger, boolean trackAllInvocations) { - setUseDynamicLogger(useDynamicLogger); - setTrackAllInvocations(trackAllInvocations); - } - - - /** - * Set whether to track all invocations that go through this interceptor, - * or just invocations with trace logging enabled. - *
Default is "false": Only invocations with trace logging enabled will - * be monitored. Specify "true" to let JAMon track all invocations, - * gathering statistics even when trace logging is disabled. - */ - public void setTrackAllInvocations(boolean trackAllInvocations) { - this.trackAllInvocations = trackAllInvocations; - } - - - /** - * Always applies the interceptor if the "trackAllInvocations" flag has been set; - * else just kicks in if the log is enabled. - * @see #setTrackAllInvocations - * @see #isLogEnabled - */ - @Override - protected boolean isInterceptorEnabled(MethodInvocation invocation, Log logger) { - return (this.trackAllInvocations || isLogEnabled(logger)); - } - - /** - * Wraps the invocation with a JAMon Monitor and writes the current - * performance statistics to the log (if enabled). - * @see com.jamonapi.MonitorFactory#start - * @see com.jamonapi.Monitor#stop - */ - @Override - protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable { - String name = createInvocationTraceName(invocation); - MonKey key = new MonKeyImp(name, name, "ms."); - - Monitor monitor = MonitorFactory.start(key); - try { - return invocation.proceed(); - } - catch (Throwable ex) { - trackException(key, ex); - throw ex; - } - finally { - monitor.stop(); - if (!this.trackAllInvocations || isLogEnabled(logger)) { - writeToLog(logger, "JAMon performance statistics for method [" + name + "]:\n" + monitor); - } - } - } - - /** - * Count the thrown exception and put the stack trace in the details portion of the key. - * This will allow the stack trace to be viewed in the JAMon web application. - */ - protected void trackException(MonKey key, Throwable ex) { - String stackTrace = "stackTrace=" + Misc.getExceptionTrace(ex); - key.setDetails(stackTrace); - - // Specific exception counter. Example: java.lang.RuntimeException - MonitorFactory.add(new MonKeyImp(ex.getClass().getName(), stackTrace, "Exception"), 1); - - // General exception counter which is a total for all exceptions thrown - MonitorFactory.add(new MonKeyImp(MonitorFactory.EXCEPTIONS_LABEL, stackTrace, "Exception"), 1); - } - -} diff --git a/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java b/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java index 6a0e5315feb..610f950cff7 100644 --- a/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java +++ b/spring-aop/src/main/java/org/springframework/aop/interceptor/PerformanceMonitorInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2021 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. @@ -31,7 +31,6 @@ import org.springframework.util.StopWatch; * @author Dmitriy Kopylenko * @author Rob Harrop * @see org.springframework.util.StopWatch - * @see JamonPerformanceMonitorInterceptor */ @SuppressWarnings("serial") public class PerformanceMonitorInterceptor extends AbstractMonitoringInterceptor { diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptorTests.java deleted file mode 100644 index 18556d6df50..00000000000 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptorTests.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2002-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.aop.interceptor; - -import com.jamonapi.MonitorFactory; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.logging.Log; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - -/** - * @author Steve Souza - * @since 4.1 - */ -public class JamonPerformanceMonitorInterceptorTests { - - private final JamonPerformanceMonitorInterceptor interceptor = new JamonPerformanceMonitorInterceptor(); - - private final MethodInvocation mi = mock(MethodInvocation.class); - - private final Log log = mock(Log.class); - - - @BeforeEach - public void setUp() { - MonitorFactory.reset(); - } - - @AfterEach - public void tearDown() { - MonitorFactory.reset(); - } - - - @Test - public void testInvokeUnderTraceWithNormalProcessing() throws Throwable { - given(mi.getMethod()).willReturn(String.class.getMethod("toString")); - - interceptor.invokeUnderTrace(mi, log); - - assertThat(MonitorFactory.getNumRows() > 0).as("jamon must track the method being invoked").isTrue(); - assertThat(MonitorFactory.getReport().contains("toString")).as("The jamon report must contain the toString method that was invoked").isTrue(); - } - - @Test - public void testInvokeUnderTraceWithExceptionTracking() throws Throwable { - given(mi.getMethod()).willReturn(String.class.getMethod("toString")); - given(mi.proceed()).willThrow(new IllegalArgumentException()); - - assertThatIllegalArgumentException().isThrownBy(() -> - interceptor.invokeUnderTrace(mi, log)); - - assertThat(MonitorFactory.getNumRows()).as("Monitors must exist for the method invocation and 2 exceptions").isEqualTo(3); - assertThat(MonitorFactory.getReport().contains("toString")).as("The jamon report must contain the toString method that was invoked").isTrue(); - assertThat(MonitorFactory.getReport().contains(MonitorFactory.EXCEPTIONS_LABEL)).as("The jamon report must contain the generic exception: " + MonitorFactory.EXCEPTIONS_LABEL).isTrue(); - assertThat(MonitorFactory.getReport().contains("IllegalArgumentException")).as("The jamon report must contain the specific exception: IllegalArgumentException'").isTrue(); - } - -} diff --git a/spring-web/spring-web.gradle b/spring-web/spring-web.gradle index f066790df20..40d915ea6bf 100644 --- a/spring-web/spring-web.gradle +++ b/spring-web/spring-web.gradle @@ -35,9 +35,8 @@ dependencies { optional("org.eclipse.jetty:jetty-reactive-httpclient") optional('org.apache.httpcomponents.client5:httpclient5') optional('org.apache.httpcomponents.core5:httpcore5-reactive') - optional("com.squareup.okhttp3:okhttp") optional("org.apache.httpcomponents:httpclient") - optional("org.apache.httpcomponents:httpasyncclient") + optional("com.squareup.okhttp3:okhttp") optional("com.fasterxml.woodstox:woodstox-core") optional("com.fasterxml:aalto-xml") optional("com.fasterxml.jackson.core:jackson-databind") diff --git a/spring-webflux/spring-webflux.gradle b/spring-webflux/spring-webflux.gradle index 464f3f8902c..67773a507ca 100644 --- a/spring-webflux/spring-webflux.gradle +++ b/spring-webflux/spring-webflux.gradle @@ -21,7 +21,7 @@ dependencies { exclude group: "jakarta.servlet", module: "jakarta.servlet-api" } optional("org.eclipse.jetty.websocket:websocket-jetty-client") - optional("io.undertow:undertow-websockets-jsr-jakartaee9") + optional("io.undertow:undertow-websockets-jsr-jakarta") optional("org.apache.httpcomponents:httpclient") optional("org.jetbrains.kotlin:kotlin-reflect") optional("org.jetbrains.kotlin:kotlin-stdlib") diff --git a/spring-websocket/spring-websocket.gradle b/spring-websocket/spring-websocket.gradle index fe4f65250ff..8fdf48c5079 100644 --- a/spring-websocket/spring-websocket.gradle +++ b/spring-websocket/spring-websocket.gradle @@ -18,8 +18,8 @@ dependencies { } optional("org.eclipse.jetty.websocket:websocket-jetty-client") optional("org.eclipse.jetty:jetty-client") - optional("io.undertow:undertow-servlet-jakartaee9") - optional("io.undertow:undertow-websockets-jsr-jakartaee9") + optional("io.undertow:undertow-servlet-jakarta") + optional("io.undertow:undertow-websockets-jsr-jakarta") optional("com.fasterxml.jackson.core:jackson-databind") testImplementation(testFixtures(project(":spring-core"))) testImplementation(testFixtures(project(":spring-web")))