@Component public class SpringUtil extends Object implements org.springframework.context.ApplicationContextAware
Constructor and Description |
---|
SpringUtil() |
Modifier and Type | Method and Description |
---|---|
static org.springframework.context.ApplicationContext |
getApplicationContext() |
static <T> T |
getBean(Class<T> clazz) |
static <T> T |
getBean(String name)
根据name获取bean
|
static <T> T |
getBean(String name,
Class<T> clazz) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public static org.springframework.context.ApplicationContext getApplicationContext()
public static <T> T getBean(String name)
T
- name
- public static <T> T getBean(Class<T> clazz)
Copyright © 2019. All rights reserved.