-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
continew-starter-core/src/main/java/top/continew/starter/core/util/SpringUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. | ||
* <p> | ||
* 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 | ||
* <p> | ||
* http://www.gnu.org/licenses/lgpl.html | ||
* <p> | ||
* 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 <T> 目标对象类型 | ||
* @return 代理对象 | ||
* @since 2.8.2 | ||
*/ | ||
public static <T> T getProxy(T target) { | ||
return (T)SpringUtil.getBean(target.getClass()); | ||
} | ||
} |