给SpringAware类补上@Override
This commit is contained in:
parent
75dce7b7c4
commit
a7697c48d1
|
@ -23,6 +23,7 @@ public class SpringAware implements ApplicationContextAware, ContextAware {
|
||||||
public SpringAware() {
|
public SpringAware() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setApplicationContext(ApplicationContext ac) throws BeansException {
|
public void setApplicationContext(ApplicationContext ac) throws BeansException {
|
||||||
applicationContext = ac;
|
applicationContext = ac;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +32,7 @@ public class SpringAware implements ApplicationContextAware, ContextAware {
|
||||||
return applicationContext;
|
return applicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T> T getBean(String name) {
|
public <T> T getBean(String name) {
|
||||||
try{
|
try{
|
||||||
T t = (T) applicationContext.getBean(name);
|
T t = (T) applicationContext.getBean(name);
|
||||||
|
@ -40,6 +42,7 @@ public class SpringAware implements ApplicationContextAware, ContextAware {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T> T getBean(Class<T> clazz) {
|
public <T> T getBean(Class<T> clazz) {
|
||||||
try{
|
try{
|
||||||
T t = applicationContext.getBean(clazz);
|
T t = applicationContext.getBean(clazz);
|
||||||
|
@ -49,6 +52,7 @@ public class SpringAware implements ApplicationContextAware, ContextAware {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T> T registerBean(String beanName, Class<T> c) {
|
public <T> T registerBean(String beanName, Class<T> c) {
|
||||||
try{
|
try{
|
||||||
DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory)applicationContext.getAutowireCapableBeanFactory();
|
DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory)applicationContext.getAutowireCapableBeanFactory();
|
||||||
|
@ -62,6 +66,7 @@ public class SpringAware implements ApplicationContextAware, ContextAware {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T> T registerBean(Class<T> c) {
|
public <T> T registerBean(Class<T> c) {
|
||||||
return registerBean(c.getName(), c);
|
return registerBean(c.getName(), c);
|
||||||
}
|
}
|
||||||
|
@ -74,6 +79,7 @@ public class SpringAware implements ApplicationContextAware, ContextAware {
|
||||||
return (T) configurableApplicationContext.getBean(beanName);
|
return (T) configurableApplicationContext.getBean(beanName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T> T registerOrGet(String beanName, Class<T> clazz) {
|
public <T> T registerOrGet(String beanName, Class<T> clazz) {
|
||||||
if (ObjectUtil.isNull(applicationContext)){
|
if (ObjectUtil.isNull(applicationContext)){
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue