public final class SpringUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static org.springframework.context.ApplicationContext |
getApplicationContext() |
static <T> T |
getBean(Class<T> type) |
static Object |
getBean(String name) |
static <T> T |
getBean(String name,
Class<T> type) |
static <T> Map<String,T> |
getBeansOfType(Class<T> type) |
static SpringUtils |
getInstance()
单例Holder模式: 优点:将懒加载和线程安全完美结合的一种方式(无锁)。
|
static org.springframework.context.ApplicationContext |
publishEvent(Object event) |
static void |
setApplicationContext(org.springframework.context.ApplicationContext ctx) |
public static SpringUtils getInstance()
public static org.springframework.context.ApplicationContext getApplicationContext()
public static void setApplicationContext(org.springframework.context.ApplicationContext ctx)
public static <T> T getBean(Class<T> type)
public static org.springframework.context.ApplicationContext publishEvent(Object event)
Copyright © 2023. All rights reserved.