From 5f6822742fd0f032bcc351155f0b966d24b05346 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 9 Jan 2025 20:42:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(core):=20SpringUtils=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=BB=A3=E7=90=86=E5=AF=B9=E8=B1=A1=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../starter/core/util/SpringUtils.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 continew-starter-core/src/main/java/top/continew/starter/core/util/SpringUtils.java diff --git a/continew-starter-core/src/main/java/top/continew/starter/core/util/SpringUtils.java b/continew-starter-core/src/main/java/top/continew/starter/core/util/SpringUtils.java new file mode 100644 index 00000000..087e4ffd --- /dev/null +++ b/continew-starter-core/src/main/java/top/continew/starter/core/util/SpringUtils.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + *

+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.gnu.org/licenses/lgpl.html + *

+ * 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 top.continew.starter.core.util; + +import cn.hutool.extra.spring.SpringUtil; + +/** + * Spring 工具类 + * + * @author Charles7c + * @since 2.8.2 + */ +public class SpringUtils { + + private SpringUtils() { + } + + /** + * 获取代理对象 + * + * @param target 目标对象 + * @param 目标对象类型 + * @return 代理对象 + * @since 2.8.2 + */ + public static T getProxy(T target) { + return (T)SpringUtil.getBean(target.getClass()); + } +}