Skip to content

Commit 9717461

Browse files
authored
fix: NoClassDefFoundError: org/springframework/http/HttpMethod (#552)
* 修复spring HttpMethod类冲突问题 * revert changes: RecordLimiter.java * remove unused import
1 parent 41e91b4 commit 9717461

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

arex-instrumentation-api/src/main/java/io/arex/inst/runtime/model/ArexConstants.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
package io.arex.inst.runtime.model;
22

33
public class ArexConstants {
4+
public static final String HTTP_METHOD_HEAD = "HEAD";
5+
public static final String HTTP_METHOD_OPTIONS = "OPTIONS";
6+
public static final String HTTP_METHOD_GET = "GET";
7+
public static final String HTTP_METHOD_POST = "POST";
8+
public static final String HTTP_METHOD_PUT = "PUT";
9+
410
private ArexConstants() {}
511

612
/**

arex-instrumentation/servlet/arex-httpservlet/src/main/java/io/arex/inst/httpservlet/ServletAdviceHelper.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.concurrent.Callable;
2323
import java.util.concurrent.CompletableFuture;
2424

25-
import org.springframework.http.HttpMethod;
2625
import org.springframework.web.bind.annotation.ResponseBody;
2726
import org.springframework.web.bind.annotation.RestController;
2827
import org.springframework.web.context.request.NativeWebRequest;
@@ -210,8 +209,8 @@ private static <TRequest> boolean shouldSkip(ServletAdapter<TRequest, ?> adapter
210209
}
211210

212211
// skip if pre-request http-method is HEAD or OPTIONS
213-
if (HttpMethod.HEAD.name().equals(adapter.getMethod(httpServletRequest))
214-
|| HttpMethod.OPTIONS.name().equals(adapter.getMethod(httpServletRequest))) {
212+
if (ArexConstants.HTTP_METHOD_HEAD.equals(adapter.getMethod(httpServletRequest))
213+
|| ArexConstants.HTTP_METHOD_OPTIONS.equals(adapter.getMethod(httpServletRequest))) {
215214
return true;
216215
}
217216

0 commit comments

Comments
 (0)