Sentinel module support JakartaEE

pull/2979/head
ruansheng 2 years ago
parent cb74bc3f6c
commit 7d5b3571a0

@ -19,7 +19,7 @@
<properties>
<revision>2022.0.0.0-SNAPSHOT</revision>
<sentinel.version>1.8.5</sentinel.version>
<sentinel.version>1.8.6</sentinel.version>
<seata.version>1.5.2</seata.version>
<nacos.client.version>2.0.4</nacos.client.version>
<spring.context.support.version>1.0.11</spring.context.support.version>
@ -150,7 +150,7 @@
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-spring-webmvc-adapter</artifactId>
<artifactId>sentinel-spring-webmvc-6x-adapter</artifactId>
<version>${sentinel.version}</version>
</dependency>

@ -109,7 +109,7 @@
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-spring-webmvc-adapter</artifactId>
<artifactId>sentinel-spring-webmvc-6x-adapter</artifactId>
</dependency>
<dependency>

@ -86,9 +86,8 @@ public class SentinelWebAutoConfiguration implements WebMvcConfigurer {
}
else {
if (StringUtils.hasText(properties.getBlockPage())) {
// todo spring boot 3.0 upgrade: not support jakarta servlet
// sentinelWebMvcConfig.setBlockExceptionHandler(((request, response,
// e) -> response.sendRedirect(properties.getBlockPage())));
sentinelWebMvcConfig.setBlockExceptionHandler(((request, response,
e) -> response.sendRedirect(properties.getBlockPage())));
}
else {
sentinelWebMvcConfig

@ -16,14 +16,13 @@
package com.alibaba.cloud.sentinel;
import jakarta.servlet.http.HttpServletRequest;
import com.alibaba.cloud.sentinel.custom.SentinelAutoConfiguration;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.DefaultBlockExceptionHandler;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.UrlCleaner;
import com.alibaba.csp.sentinel.adapter.spring.webmvc.config.SentinelWebMvcConfig;
import jakarta.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -101,16 +100,15 @@ public class SentinelBeanAutowiredTests {
};
}
// todo spring boot 3.0 upgrade: not support jakarta servlet
// @Bean
// public RequestOriginParser requestOriginParser() {
// return new RequestOriginParser() {
// @Override
// public String parseOrigin(HttpServletRequest httpServletRequest) {
// return httpServletRequest.getRemoteAddr();
// }
// };
// }
@Bean
public RequestOriginParser requestOriginParser() {
return new RequestOriginParser() {
@Override
public String parseOrigin(HttpServletRequest httpServletRequest) {
return httpServletRequest.getRemoteAddr();
}
};
}
@Bean
public BlockExceptionHandler blockExceptionHandler() {

@ -17,7 +17,7 @@
<module>nacos-tests</module>
<!-- todo spring boot 3.0 upgrade: wait to support jdk17 and spring cloud stream -->
<!-- <module>rocketmq-tests</module> -->
<!-- <module>sentinel-tests</module> -->
<module>sentinel-tests</module>
</modules>
<properties>

Loading…
Cancel
Save