From 53ad4969b0c67be6ac8fdbd39f3cf99d14b4bc80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Mon, 3 Jul 2023 10:15:37 +0800 Subject: [PATCH] =?UTF-8?q?update=20dynamic-ds=203.6.1=20=3D>=204.0.0=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20SpringBoot3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 +- ruoyi-common/ruoyi-common-mybatis/pom.xml | 2 +- .../jakarta/DsJakartaHeaderProcessor.java | 45 ------------------ .../jakarta/DsJakartaSessionProcessor.java | 46 ------------------- 4 files changed, 3 insertions(+), 94 deletions(-) delete mode 100644 ruoyi-common/ruoyi-common-mybatis/src/main/java/com/baomidou/dynamic/datasource/processor/jakarta/DsJakartaHeaderProcessor.java delete mode 100644 ruoyi-common/ruoyi-common-mybatis/src/main/java/com/baomidou/dynamic/datasource/processor/jakarta/DsJakartaSessionProcessor.java diff --git a/pom.xml b/pom.xml index e9cf3866..33fa3bd7 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ 3.0.4 3.20.1 2.2.4 - 3.6.1 + 4.0.0 2.14.2 4.3.3 1.3.1 @@ -201,7 +201,7 @@ com.baomidou - dynamic-datasource-spring-boot-starter + dynamic-datasource-spring-boot3-starter ${dynamic-ds.version} diff --git a/ruoyi-common/ruoyi-common-mybatis/pom.xml b/ruoyi-common/ruoyi-common-mybatis/pom.xml index 3acb608c..51199b40 100644 --- a/ruoyi-common/ruoyi-common-mybatis/pom.xml +++ b/ruoyi-common/ruoyi-common-mybatis/pom.xml @@ -29,7 +29,7 @@ com.baomidou - dynamic-datasource-spring-boot-starter + dynamic-datasource-spring-boot3-starter diff --git a/ruoyi-common/ruoyi-common-mybatis/src/main/java/com/baomidou/dynamic/datasource/processor/jakarta/DsJakartaHeaderProcessor.java b/ruoyi-common/ruoyi-common-mybatis/src/main/java/com/baomidou/dynamic/datasource/processor/jakarta/DsJakartaHeaderProcessor.java deleted file mode 100644 index f0a50a2d..00000000 --- a/ruoyi-common/ruoyi-common-mybatis/src/main/java/com/baomidou/dynamic/datasource/processor/jakarta/DsJakartaHeaderProcessor.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright © 2018 organization baomidou - * - * 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 com.baomidou.dynamic.datasource.processor.jakarta; - -import com.baomidou.dynamic.datasource.processor.DsProcessor; -import jakarta.servlet.http.HttpServletRequest; -import org.aopalliance.intercept.MethodInvocation; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - -/** - * @author TaoYu - * @since 3.6.0 - */ -public class DsJakartaHeaderProcessor extends DsProcessor { - - /** - * header prefix - */ - private static final String HEADER_PREFIX = "#header"; - - @Override - public boolean matches(String key) { - return key.startsWith(HEADER_PREFIX); - } - - @Override - public String doDetermineDatasource(MethodInvocation invocation, String key) { - HttpServletRequest request = (HttpServletRequest) ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - return request.getHeader(key.substring(8)); - } -} diff --git a/ruoyi-common/ruoyi-common-mybatis/src/main/java/com/baomidou/dynamic/datasource/processor/jakarta/DsJakartaSessionProcessor.java b/ruoyi-common/ruoyi-common-mybatis/src/main/java/com/baomidou/dynamic/datasource/processor/jakarta/DsJakartaSessionProcessor.java deleted file mode 100644 index 0ea8a130..00000000 --- a/ruoyi-common/ruoyi-common-mybatis/src/main/java/com/baomidou/dynamic/datasource/processor/jakarta/DsJakartaSessionProcessor.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright © 2018 organization baomidou - * - * 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 com.baomidou.dynamic.datasource.processor.jakarta; - -import com.baomidou.dynamic.datasource.processor.DsProcessor; -import jakarta.servlet.http.HttpServletRequest; -import org.aopalliance.intercept.MethodInvocation; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - - -/** - * @author TaoYu - * @since 3.6.0 - */ -public class DsJakartaSessionProcessor extends DsProcessor { - - /** - * session开头 - */ - private static final String SESSION_PREFIX = "#session"; - - @Override - public boolean matches(String key) { - return key.startsWith(SESSION_PREFIX); - } - - @Override - public String doDetermineDatasource(MethodInvocation invocation, String key) { - HttpServletRequest request = (HttpServletRequest) ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - return request.getSession().getAttribute(key.substring(9)).toString(); - } -}